简单题。
附ac代码:
#include <stdio.h>
int main(){
int n;
double x, s;
while(scanf("%lf", &x), x){
s = 0;
n = 1;
while(s < x)
s += 1.0 / ++n;
printf("%d card(s)\n", n - 1);
}
return 0;
}
简单题。
附ac代码:
#include <stdio.h>
int main(){
int n;
double x, s;
while(scanf("%lf", &x), x){
s = 0;
n = 1;
while(s < x)
s += 1.0 / ++n;
printf("%d card(s)\n", n - 1);
}
return 0;
}
转载于:https://www.cnblogs.com/changmu/p/3639834.html