hdu1085

View Code
   
     
1 #include " iostream "
2 using namespace std;
3 int main()
4 {
5 int a,b,c;
6 int sum;
7 while (cin >> a >> b >> c,a + b + c)
8 {
9 if (a == 0 ) sum = 1 ;
10 if (b == 0 && a)
11 {
12 if (c == 0 ) sum = a + 1 ;
13 else if (c)
14 {
15 if (a < 4 ) sum = a + 1 ;
16 else sum = a + 5 * c + 1 ;
17 }
18 }
19 if (a * b && c == 0 ) sum = a + 2 * b + 1 ;
20 if (c * a * b)
21 {
22 if (a + 2 * b < 4 ) sum = a + 2 * b + 1 ;
23 else
24 sum = a + 2 * b + 5 * c + 1 ;
25 }
26
27 cout << sum << endl;
28 }
29 return 0 ;
30 }

你可能感兴趣的:(HDU)