HangOver
http://acm.zju.edu.cn/show_problem.php?pid=1045
1
2 #include
3
4 int main() {
5 while(1) {
6 double l, t;
7 int i;
8 scanf("%lf", &l);
9 if(l==0.0)
10 break;
11
12 t = 0.0;
13 for(i = 1; t<l ;i++)
14 t += 1.0/(i+1);
15 printf("%d card(s)\n", i-1);
16 }
17 }
zju1045 (2008-06-02 13:13:28由czk编辑)