http://acm.hdu.edu.cn/showproblem.php?pid=1085看这个 就知道会有规律 然后 一直都没有考虑 a == 0 的情况
# include<stdio.h>
# include<math.h>
# include<stdlib.h>
# include<string.h>
# include<ctype.h>
# include<limits.h>
# include<iostream>
# include<algorithm>
using namespace std;
int main()
{
int a,b,c,sum = 0;;
while(scanf("%d%d%d",&a,&b,&c),a||b||c)
{
if(a == 0)
sum = 1;
else if(a + 2*b + 1< 5 )
sum = a + 2*b +1;
else
sum = a + 2*b + 5*c + 1;
printf("%d\n",sum);
}
return 0;
}
posted on 2010-08-10 11:02
付翔 阅读(90)
评论(0) 编辑 收藏 引用 所属分类:
ACM 数据结构