标签:
573 The Snail
1 #include<iostream> 2 using namespace std; 3 int main() 4 { 5 int day; 6 double height,down; 7 double H, U, D, F; 8 while (cin >> H >> U >> D >> F) 9 { 10 day =1; 11 height = 0; 12 if (H == 0 && U == 0 && D == 0 && F == 0) 13 break; 14 down = U*F / 100; 15 while (1) 16 { 17 if (U > 0) 18 height += U; 19 if (height > H) 20 { 21 cout << "success on day " << day << endl; 22 break; 23 } 24 height -= D; 25 if (height <0) 26 { 27 cout << "failure on day " << day << endl; 28 break; 29 } 30 U -= down; 31 ++day; 32 } 33 } 34 return 0; 35 }
846 Steps
1 #include<stdio.h> 2 int main() 3 { 4 double m,n,dis; 5 int T,step,ans; 6 bool flag; 7 scanf("%d", &T); 8 while (T--) 9 { 10 scanf("%lf%lf", &m, &n); 11 dis = n - m; 12 step = 1; 13 flag = 0; 14 ans = 0; 15 while (dis > 0) 16 { 17 dis -= step; 18 ans++; 19 if (flag) 20 ++step; 21 flag = !flag; 22 } 23 printf("%d\n",ans); 24 } 25 return 0; 26 }
10499 The Land of Justice
1 #include<stdio.h> 2 int main() 3 { 4 double n; 5 while (scanf("%lf", &n)!=EOF) 6 { 7 if (n < 0) 8 return 0; 9 if (n == 1) 10 printf("0%%\n"); 11 else 12 printf("%.0lf%%\n", 25 * n); 13 } 14 return 0; 15 }
10916 Factstone Benchmark
1 #include<cstdio> 2 #include<cmath> 3 #include<iostream> 4 using namespace std; 5 int main() 6 { 7 long x, y, k,z; 8 double t,i; 9 while (scanf("%d", &x) && x != 0) 10 { 11 t = 0; 12 y = (x - 1960) / 10 + 2; 13 z = pow(2, y); 14 for (i = 1;; i++) 15 { 16 t += log10(i) / log10(2); 17 if (t>z) 18 { 19 k = i - 1; 20 break; 21 } 22 } 23 printf("%d\n", k); 24 } 25 return 0; 26 }
10970 Big Chocolate
1 #include<stdio.h> 2 int main() 3 { 4 int m, n; 5 while (scanf("%d%d", &m, &n) != EOF) 6 printf("%d\n",(m-1)+m*(n-1)); 7 return 0; 8 }
11044 Searching for Nessy
1 #include<stdio.h> 2 int main() 3 { 4 int T; 5 int m, n; 6 scanf("%d", &T); 7 while (T--) 8 { 9 scanf("%d%d", &m, &n); 10 printf("%d\n", (m / 3)*(n / 3)); 11 } 12 return 0; 13 }
标签:
原文地址:http://www.cnblogs.com/longzu/p/4481226.html