2014年2月9日

Text Reverse

摘要: Problem DescriptionIgnatius likes to write words in reverse way. Given a single line of text which is written by Ignatius, you should reverse all the words and then output them.InputThe input contains several test cases. The first line of the input is a single integer T which is the number of test c 阅读全文

posted @ 2014-02-09 16:21 acm_shun 阅读(1286) 评论(0) 推荐(0) 编辑

16进制A+B

摘要: Problem DescriptionMany classmates said to me that A+B is must needs. If you can’t AC this problem, you would invite me for night meal. ^_^InputInput may contain multiple test cases. Each case contains A and B in one line. A, B are hexadecimal number. Input terminates by EOF.OutputOutput A+B in deci 阅读全文

posted @ 2014-02-09 15:37 acm_shun 阅读(365) 评论(0) 推荐(0) 编辑

Elevator (又见水题)

摘要: Problem Description The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move down one floor. Th 阅读全文

posted @ 2014-02-09 15:10 acm_shun 阅读(389) 评论(0) 推荐(0) 编辑

2014年1月2日

2034 人见人爱A-B

摘要: Problem Description参加过上个月月赛的同学一定还记得其中的一个最简单的题目,就是{A}+{B},那个题目求的是两个集合的并集,今天我们这个A-B求的是两个集合的差,就是做集合的减法运算。(当然,大家都知道集合的定义,就是同一个集合中不会有两个相同的元素,这里还是提醒大家一下)呵呵,很简单吧? Input每组输入数据占1行,每行数据的开始是2个整数n(0 2 int main() 3 { 4 int comp(const void*a,const void*b); 5 int i,j,n,m,a[100],b[100],c[100],k; 6 while... 阅读全文

posted @ 2014-01-02 22:49 acm_shun 阅读(702) 评论(0) 推荐(0) 编辑

2033 人见人爱A+B

摘要: Problem DescriptionHDOJ上面已经有10来道A+B的题目了,相信这些题目曾经是大家的最爱,希望今天的这个A+B能给大家带来好运,也希望这个题目能唤起大家对ACM曾经的热爱。这个题目的A和B不是简单的整数,而是两个时间,A和B 都是由3个整数组成,分别表示时分秒,比如,假设A为34 45 56,就表示A所表示的时间是34小时 45分钟 56秒。 Input输入数据有多行组成,首先是一个整数N,表示测试实例的个数,然后是N行数据,每行有6个整数AH,AM,AS,BH,BM,BS,分别表示时间A和B所对应的时分秒。题目保证所有的数据合法。 Output对于每个测试实例,输出A+B 阅读全文

posted @ 2014-01-02 22:48 acm_shun 阅读(244) 评论(0) 推荐(0) 编辑

2032 杨辉三角

摘要: Problem Description还记得中学时候学过的杨辉三角吗?具体的定义这里不再描述,你可以参考以下的图形:11 11 2 11 3 3 11 4 6 4 11 5 10 10 5 1Input输入数据包含多个测试实例,每个测试实例的输入只包含一个正整数n(1 2 using namespace std; 3 4 void zuhe(int n, long long int jie, int i) 5 { 6 if(i>=n/2) 7 return; 8 jie = jie*(n-i)/(1+i); 9 printf(" %lld",jie);... 阅读全文

posted @ 2014-01-02 22:47 acm_shun 阅读(290) 评论(0) 推荐(0) 编辑

2031 进制转换

摘要: Problem Description输入一个十进制数N,将它转换成R进制数输出。 Input输入数据包含多个测试实例,每个测试实例包含两个整数N(32位整数)和R(210)。 Output为每个测试实例输出转换后的数,每个输出占一行。如果R大于10,则对应的数字规则参考16进制(比如,10用A表示,等等)。 Sample Input7 223 12-4 3 Sample Output1111B-11code: 1 #include 2 using namespace std; 3 4 int main(){ 5 int n,r,k,i; 6 char m[33]; 7 ... 阅读全文

posted @ 2014-01-02 22:45 acm_shun 阅读(202) 评论(0) 推荐(0) 编辑

2030 汉字统计

摘要: Problem Description统计给定文本文件中汉字的个数。 Input输入文件首先包含一个整数n,表示测试实例的个数,然后是n段文本。 Output对于每一段文本,输出其中的汉字的个数,每个测试实例的输出占一行。[Hint:]从汉字机内码的特点考虑~ Sample Input2WaHaHa! WaHaHa! 今年过节不说话要说只说普通话WaHaHa! WaHaHa!马上就要期末考试了Are you ready? Sample Output149code: 1 #include 2 using namespace std; 3 4 int main(){ 5 int n,i,... 阅读全文

posted @ 2014-01-02 22:44 acm_shun 阅读(235) 评论(0) 推荐(0) 编辑

2029 Palindromes _easy version

摘要: Problem Description“回文串”是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串。请写一个程序判断读入的字符串是否是“回文”。 Input输入包含多个测试实例,输入数据的第一行是一个正整数n,表示测试实例的个数,后面紧跟着是n个字符串。 Output如果一个字符串是回文串,则输出"yes",否则输出"no". Sample Input4levelabcdenoonhaha Sample Outputyesnoyesnocode: 1 #include 2 using namespace std; 3 4 i 阅读全文

posted @ 2014-01-02 13:44 acm_shun 阅读(232) 评论(0) 推荐(0) 编辑

2028 Lowest Common Multiple Plus

摘要: Problem Description求n个数的最小公倍数。 Input输入包含多个测试实例,每个测试实例的开始是一个正整数n,然后是n个正整数。 Output为每组测试数据输出它们的最小公倍数,每个测试实例的输出占一行。你可以假设最后的输出是一个32位的整数。 Sample Input2 4 63 2 5 7 Sample Output1270code: 1 #include 2 using namespace std; 3 4 int gcd(int a, int b) 5 { 6 int n; 7 if(a> n)28 {29 for(i=0;i... 阅读全文

posted @ 2014-01-02 13:43 acm_shun 阅读(170) 评论(0) 推荐(0) 编辑

导航