Problem DescriptionGiven a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequences that the sum of the sub-sequence is M.InputInput contains multiple test cases. each case contains two integers N, M( 1 0 6 所以2*m>j*j----j 9 #include 10 int main()11 {12 int n,m,i,j;13 whi... Read More
posted @ 2013-07-11 22:32 瓶哥 Views(261) Comments(0) Diggs(0) Edit
Problem DescriptionThere must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal too. Easy ? AC it !InputThe input contains several test cases, please process to the end of the file. Read More
posted @ 2013-07-11 22:29 瓶哥 Views(639) Comments(0) Diggs(0) Edit
Problem DescriptionGiven two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the intersected part of two rectangles. its sides are parallel to OX and OY .InputInput The first line of input is 8 positive numbers which indicate the coor Read More
posted @ 2013-07-11 22:27 瓶哥 Views(276) Comments(0) Diggs(0) Edit
Problem Descriptionwe define f(A) = 1, f(a) = -1, f(B) = 2, f(b) = -2, ... f(Z) = 26, f(z) = -26; Give you a letter x and a number y , you should output the result of y+f(x).InputOn the first line, contains a number T.then T lines follow, each line is a case.each case contains a letter and a number. Read More
posted @ 2013-07-11 22:26 瓶哥 Views(322) Comments(0) Diggs(0) Edit
Problem DescriptionGive you two numbers A and B, if A is equal to B, you should print "YES", or print "NO".Inputeach test case contains two numbers A and B.Outputfor each case, if A is equal to B, you should print "YES", or print "NO".Sample Input1 2 2 2 3 3 4 Read More
posted @ 2013-07-11 22:25 瓶哥 Views(278) Comments(0) Diggs(0) Edit
Problem DescriptionThere are many lamps in a line. All of them are off at first. A series of operations are carried out on these lamps. On the i-th operation, the lamps whose numbers are the multiple of i change the condition ( on to off and off to on ).InputEach test case contains only a number n ( Read More
posted @ 2013-07-11 22:20 瓶哥 Views(389) Comments(0) Diggs(0) Edit
Problem DescriptionGive you the width and height of the rectangle,darw it.InputInput contains a number of test cases.For each case ,there are two numbers n and m (0 2 int main() 3 { 4 int n,m; 5 while(~scanf("%d%d",&n,&m)) 6 { 7 printf("+"); 8 for(int i=0;i<n... Read More
posted @ 2013-07-11 22:19 瓶哥 Views(524) Comments(0) Diggs(0) Edit
Problem DescriptionGive you a number on base ten,you should output it on base two.(0 2 int main() 3 { 4 int n, i, ans[11]; 5 while(~scanf("%d",&n)) 6 { 7 if(n==0) 8 { 9 printf("0\n"); 10 }11 for(i=0;n;i++... Read More
posted @ 2013-07-11 22:17 瓶哥 Views(313) Comments(0) Diggs(0) Edit
stringstream包括istringstream和ostringstream,提供读写string的功能,使用时需包含stream文件。4个操作:1. stringstream strm; 创建stringstream对象2. stringstream strm(s) ; s是string,复制构造函数3. strm.str() ; 返回strm中存储的string类型对象4. strm.str(s); 将string s复制给strm, 返回void功能:1.细化处理功能。如处理文件每行的同时处理每个单词,可用stringstream实现。string line, word;whil. Read More
posted @ 2013-07-11 17:04 瓶哥 Views(1478) Comments(0) Diggs(0) Edit
1,set的含义是集合,它是一个有序的容器,里面的元素都是排序好的,支持插入,删除,查找等操作,就像一个集合一样。所有的操作的都是严格在logn时间之内完成,效率非常高。set和multiset的区别是:set插入的元素不能相同,但是multiset可以相同。创建 multiset base;删除:如果删除元素a,那么在定义的比较关系下和a相等的所有元素都会被删除base.count( a ):set能返回0或者1,multiset是有多少个返回多少个.Set和multiset都是引用头文件,复杂度都是logn2,Set中的元素可以是任意类型的,但是由于需要排序,所以元素必须有一个序,即大小的 Read More
posted @ 2013-07-11 16:25 瓶哥 Views(166) Comments(0) Diggs(0) Edit