摘要: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=1003Problem DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14.InputThe first line of the input contains an 阅读全文
posted @ 2011-05-09 20:29 淡墨æ末央 阅读(586) 评论(0) 推荐(0) 编辑
摘要: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=2017Problem Description对于给定的一个字符串,统计其中数字字符出现的次数。Input输入数据有多行,第一行是一个整数n,表示测试实例的个数,后面跟着n行,每行包括一个由字母和数字组成的字符串。Output对于每个测试实例,输出该串中数值的个数,每个输出占一行。Sample Input2asdfasdf123123asdfasdfasdf111111111asdfasdfasdfSample Output69超级水题;直接上代码 1 /********* hdu 2017 ****** 阅读全文
posted @ 2011-05-09 20:14 淡墨æ末央 阅读(836) 评论(1) 推荐(0) 编辑
摘要: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=2016输入n(n<100)个数,找出其中最小的数,将它与最前面的数交换后输出这些数。Input输入数据有多组,每组占一行,每行的开始是一个整数n,表示这个测试实例的数值的个数,跟着就是n个整数。n=0表示输入的结束,不做处理。Output对于每组输入数据,输出交换后的数列,每组输出占一行。Sample Input4 2 1 3 45 5 4 3 2 10Sample Output1 2 3 41 4 3 2 5思路:标记最小值,然后交换 1 /********* hdu 2016 ******** 阅读全文
posted @ 2011-05-09 19:42 淡墨æ末央 阅读(615) 评论(0) 推荐(0) 编辑