ST_Pace @ 2017-03-22 20:40:18
#include<stdio.h>
int main(void)
{
int k,n;
float sn;
sn=0;
n=1;
scanf("%d",&k);
while(1)
{
sn+=1.0/n;
if(sn>k)
{
printf("%d",n);
break;
}
else
{
n++;
}
}
return 0;
}
by Dark_Kotori @ 2017-03-22 20:53:16
把sn设成double型再试试