hooray @ 2017-01-25 21:15:41
#include<stdio.h>
main(){
int a,i;
double sn=0;
scanf("%d",&a);
for(i=1;sn<(double)a;i++){
sn=sn+1.0/i;
}
printf("%d",i);
return 0;
}
by huihao @ 2017-01-28 19:41:47
main(){
int a,i;
把这个int,改为double
by huihao @ 2017-01-28 19:45:17
#include<stdio.h>
int main(){
double a,i;
double sn=0;
scanf("%lf",&a);
for(i=1;sn<=a;i++){
sn=sn+1/i;
}
printf("%.0lf",i-1);
return 0;
}
这是改过后的;