超时了吗?

P1035 [NOIP2002 普及组] 级数求和

imbecile @ 2020-05-17 13:52:55

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n=1,k;
    double s=0.0;
    cin>>k;
    while(s<k)
    {
        s+=double(1/n);
        n++;
    }
    cout<<n;
} 

by imbecile @ 2020-05-17 14:09:05

@江户川·萝卜 额


上一页 |