aaaa___ @ 2018-07-25 19:26:33
using namespace std; int main() { int n=0,t=0,k; double Sn; scanf("%d",k); while(Sn<=k) {
++n;
t=1/n;
Sn+=t;
} printf("%d",n); return 0; }
by aaaa___ @ 2018-07-25 19:28:06
using namespace std; int main() { int n=0,t=0,k; double Sn; scanf("%d",k); while(Sn<=k) {
++n;
t=1/n;
Sn+=t;
} printf("%d",n); return 0; }
by liutianze @ 2018-07-25 19:39:38
好像没问题
by liutianze @ 2018-07-25 19:39:51
----我看啊看--------
by Smile_Cindy @ 2018-07-25 19:54:36
1/n是整除,肯定是0
by Smile_Cindy @ 2018-07-25 19:54:50
所以t也是0
by aaaa___ @ 2018-07-25 21:02:46
@liutianze ·-·
by aaaa___ @ 2018-07-25 21:03:58
@Alpha 666 请问怎么解决
by Smile_Cindy @ 2018-07-25 23:10:31
把1/n改成1.0/n
by Smile_Cindy @ 2018-07-25 23:10:56
把t改成double
by aaaa___ @ 2018-07-26 12:30:52
@Alpha 试了但是没用诶,还是RE