一、使用System.in.read()一次获取一个字节 输入再多数据,只会获取第一个字节的int形式。获取的是字节,而不是字符,所以如果输入中文字符,强转后会得到乱码1 try {2 int in_num=System.in.read(); //获取的是一...
分类:
编程语言 时间:
2015-04-14 12:30:10
阅读次数:
153
#include
#include
using namespace std;
class Person{
string name;
bool gender;
int age;
Person *lover;
public:
Person(const char *n="无名",bool g=true);
void growup(int years);
void s...
分类:
编程语言 时间:
2015-04-14 11:22:46
阅读次数:
177
给出n,m
n个数字
m次询问,每次询问(l,r)区间的第k小的数
划分树模板 mark一下
#include "stdio.h"
#include "string.h"
#include "algorithm"
using namespace std;
int a[100010],as[100010];
int tree[20][100010];// 记录第i层元素序列
i...
分类:
其他好文 时间:
2015-04-14 11:19:38
阅读次数:
120
1、左移(>>)
符号位一起参加移位
对于int型,最大的移位数是31,当>=32时,对32取模然后移位;
对于long型,最大的移位数是62,当>=64时,对64取模然后移位;
观察一段代码:
import java.util.*;
public class Test{
public static void main(String[] args){...
分类:
其他好文 时间:
2015-04-14 11:14:58
阅读次数:
120
(1) 分配内存给一幅新图像:
IplImage* cvCreateImage( CvSize size, int depth, int channels );
size -图像宽、高.
depth -图像元素的位深度,可以是下面的其中之一:
IPL_DEPTH_8U - 无符号8位整型
IPL_DEPTH_8S - 有符号8位...
分类:
其他好文 时间:
2015-04-14 11:12:26
阅读次数:
284
刚开始看到最大值要取到1000000,当时就吓尿了,心想难道要改排序算法?
赶紧看了下讨论,发现数据很水,200000就能过了
思路:就是答案二分,然后长度分组,满足条件返回true
#include
#include
using namespace std;
#define N 200005
int n,k;
int r[N],height[N],sa[N],rank[N];
int wa...
分类:
其他好文 时间:
2015-04-14 11:12:16
阅读次数:
142
HIVE的分区通过在创建表时启用partitionby实现,用来partition的维度并不是实际数据的某一列,具体分区的标志是由插入内容时给定的。当要查询某一分区的内容时可以采用where语句,形似where
tablename.partition_key >a来实现。
创建含分区的表。
命令原型:
CREATE TABLE page_view(viewTime INT,...
分类:
其他好文 时间:
2015-04-14 11:10:44
阅读次数:
177
refhttp://blog.csdn.net/linhuanmars/article/details/21314059DP经典题目,关于怎么动首尾部分,ref说的很明白public class Solution { public int maxSubArray(int[] A) { ...
分类:
其他好文 时间:
2015-04-14 11:05:28
阅读次数:
105
#include
union
{
long Long;
char Char[sizeof(long)];
} u;
int main(void)
{
u.Long = 1;
if (u.Char[0] == 1) {
printf("Addressing is right-to-left\n");
}
else if (u.Ch...
分类:
其他好文 时间:
2015-04-14 10:01:37
阅读次数:
139
#include
using namespace std;
int Grail(int x)
{
int N=0;
while(x)
{
x=x&(x-1);
N++;
}
return N;
}
int main()
{
cout<<Grail(7)<<endl;
//0111
//0110
//0101
//0100
//0100
//0011
ret...
分类:
其他好文 时间:
2015-04-14 10:01:12
阅读次数:
103