#include<bits/stdc++.h> using namespace std; int main(){ int n=0,k; double a,s=0; scanf("%d",&k); while(s<=k) { n++; a=1/n; s+=a; } printf("%d",n); return 0; }
去掉中间值a,直接写1/n就过了,但不懂这个为啥不对,求助各位大佬