题目链接
https://ac.nowcoder.com/acm/contest/19305/1044
解题思路
模拟级数求和
AC代码
using namespace std;
// n:首项
double sn = 0,n = 1, k;
// 找到最小的Sn使得Sn>k
int main()
{
cin >> k;
while(sn <= k)
sn += 1/n, n ++ ;
cout << n - 1;
return 0;
}
标签:ac,NOIP2002,级数,求和,Sn,sn
From: https://www.cnblogs.com/ClockParadox43/p/17421438.html