大佬们,为什么只有60分?

P1035 [NOIP2002 普及组] 级数求和

ly792734100 @ 2017-06-13 13:31:47

#include<stdio.h>
int main(){
int k,n=0;
float sn=0,i=1;
scanf("%d",&k);
while(n<=k)
{
while(i>0){
    sn=sn+1/i;
    if(sn<=k)
        i++;
        if(sn>k)
            break;
};
   n=i;
   printf("%d",n);
   break;
};
}

by KingC @ 2017-06-16 23:11:36

奇葩


by crazySong @ 2017-06-22 09:00:41

试过了,float只能60分,需要double


|