HDU 水题
文章平均质量分 67
A_Eagle
人生苦短,及时行乐
展开
-
HDU 2563 统计问题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2563思路:赤裸裸的递推问题,设第n步的走法为F(n),往上走的步数为a(n),往左或往右走的步数为b(n);所以F(n)=a(n)+b(n);接下来分别找前一个状态。因为不能往下走,所以向上走的步数只有一种选择就是上一次的步数相加:a(n)=a(n-1)+b(n-1)(前(n-1)步内往上走的原创 2012-01-13 11:41:47 · 1756 阅读 · 0 评论 -
HDU 2029 Palindromes _easy version
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2029这题不用for循环判断,直接用strrev转置就行,水过。(不过用G++好像会编译错误,改C或C++就行)代码:#include#includeint main(){ char str1[1001],str2[1001]; int s,i,len; scanf("%d"原创 2012-01-05 13:11:25 · 1902 阅读 · 0 评论 -
HDU 2020 绝对值排序
今天终于考完了,毫无压力。现在开始刷水题了,巩固下基础,嘿嘿。如果有更好的思路或方法可以留评论下来交流。题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2020直接代码水过:#include#include#includeusing namespace std;bool comp(int x,int y){ retur原创 2011-12-31 13:55:15 · 2585 阅读 · 0 评论 -
HDU 1008 Elevator
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1008水题,直接秒过。还是说下题目大意吧,在一栋楼中只有一个电梯,上升一层要花6s,下降一层4s,到达每层时需要停留5s,计算总时间。代码:#includeint main(){ int n,i,sum,a[1001]; while(~scanf("%d",&n)&&n) {原创 2012-01-01 19:57:49 · 3031 阅读 · 0 评论 -
HDU 2022 海选女主角
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2022这题其实是跟小明调查统计是一个性质的,只是多加了一个绝对值,不懂的可以去看小明调查统计(二)。直接水过。代码:#include#include#includeusing namespace std;struct hx{ int fs; int hh;原创 2012-01-02 08:54:34 · 3393 阅读 · 0 评论 -
HDU 2028 Lowest Common Multiple Plus
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2028这道题目本来是水题,可硬是WA了三次,虽然现在AC了,a*b会超出int的范围,坑了我一个小时,悲剧。思路:将输入的数两两进行比较,题意是求最小公倍数,那就求最大公约数。两两求最小公倍数,合并在与下一个数进行比较。代码:#includeint gcd(int a,int b)原创 2012-01-06 00:35:16 · 4590 阅读 · 0 评论 -
HDU 2027 统计元音
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2027只是为了刷水题,没啥好说的,直接水过。代码:#include#includeint main(){ char str[101]; int s,i,j,len,count1,count2,count3,count4,count5; scanf("%d",&s原创 2012-01-05 11:03:46 · 1085 阅读 · 0 评论 -
HDU 2026 首字母变大写
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2026继续水,代码:#include#includeint main(){ char str[1001]; while(gets(str)) { int i,len; len=strlen(str); if(str[0]>='a'&&str[0]<=原创 2012-01-04 23:04:52 · 1051 阅读 · 0 评论 -
HDU 2025 查找最大元素
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2025会寝室不想看书,没事刷刷水题,嘿嘿。题目没什么好说的,写过了看看网上的代码觉得都差不多,稍稍修改下,直接贴上。代码:#include#includeint main(){ char max,str[101]; int len,i; while(~scanf("%s",s原创 2012-01-04 22:45:07 · 4533 阅读 · 0 评论 -
HDU 2011 多项式求和
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2011代码:#includeint main(){ int s,n,i; double sum,t; scanf("%d",&s); while(s--) { sum=0; scanf("%d",&n);原创 2011-12-31 13:58:36 · 4090 阅读 · 0 评论 -
HDU 2037 今年暑假不AC
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2037其实题目跟会场会议安排是一样的,只是上一个节目的结束时间可以与下一个节目开始的时间相同,一次水过,如果不懂的可以去看NYOJ 14 会场会议安排。代码:#include#includeusing namespace std;struct hy{ int begin; i原创 2012-01-05 14:17:00 · 1156 阅读 · 0 评论 -
HDU 4147 KFC -Z+W
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4147题目很简单,水题,求最小值,在无限输出这里卡了几下,直接水过。代码:#include#includeint main(){ char str[10001]; int s,b,d,f,F,i,j,len,sum,min; while(scanf("%d原创 2011-12-20 20:57:02 · 1323 阅读 · 0 评论 -
HDU 4144 Bacon's Cipher
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4144下午菜鸟杯比赛,这题就是菜鸟做的,表示各种用不惯VS,做了一半就回来了。题目很简单,就是0可以当作任意字母,1可以看作任意数字,将字符串翻译后以5个字符为一组作为二进制。再将二进制转化为十进制在进行数字与字母间的对应,输出字母。代码:#includeint main()原创 2011-12-18 20:06:23 · 1008 阅读 · 0 评论 -
HDU 2099 整除的尾数
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2099只是一道水题,这道题中学到的是输出格式,所以保存下来了。printf使用%02d实现输出两位宽度,且不足补0。代码:#includeint main(){ int n,m,i,k,count,a[101]; while(~scanf("%d %d",&n,&m)原创 2012-01-17 15:15:54 · 1924 阅读 · 2 评论 -
HDU 2024 C语言合法标识符
明天就是元旦了,学校人基本上走的差不多了,晚上居然还有人在寝室楼门口放鞭炮,居然有点想家了,一直以为自己不是个恋家的人。呵呵,不扯了。继续正事。题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2024这题居然做了很久,继续强调基础,勿在浮沙筑高台 进行的速度慢一些,收获会更多。题目思路:只要判断第一个字符不为数字,后面的字符都在数字、大原创 2011-12-31 22:35:23 · 7544 阅读 · 4 评论