https://www.luogu.com.cn/problem/P1035
这道题我的代码没过样例,输入1输出1,但是我却过了洛谷数据,代码如下
#include<bits/stdc++.h> using namespace std; int k,n,j=0; double d=0.0,i=1.0; int main(){ scanf("%d",&k); while(d<k){ d+=1/i; i++;j++; } printf("%d",j); return 0; }