题解

269 条题解

  • -1
    @ 2016-09-20 09:57:41
    #include<iostream>
    #include<cstdio>
    using namespace std;
    int k;
    int main()
    {
        scanf("%d",&k);
        double s;
        for(int i=1; ;i++)
        {
            s+=1.0/i;
            if(s>k)
            {
                cout<<i;
                return 0;
            }
        }
        return 0;
    }
    
  • -1
    @ 2016-09-01 18:21:11

    #include<iostream>
    using namespace std;
    int main()
    {
    double k,n,sn;
    cin>>k;
    n=0;
    sn=0;
    while(sn<=k)
    {

    n++;
    sn+=1/n;
    }
    cout<<n;
    return 0;
    }

  • -1
    @ 2016-08-03 15:00:17

    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    double s;
    int k,i;
    cin>>k;
    s=0;
    i=0;
    while(s<=k)
    {
    i++;
    s=s+1.0/i;
    }
    cout<<i<<endl;
    return 0;
    }

  • -1
    @ 2016-05-16 13:24:43

    #include <iostream>
    using namespace std;
    double k,n,sn;
    int main()
    {
    cin>>k;
    while(sn<=k)
    {
    n++;
    sn+=1/n;
    }
    cout<<n;
    return 0;
    }

  • -1
    @ 2016-05-16 13:24:38

    这题水得我不要不要的。。。

  • -1
    @ 2016-03-27 14:30:51

    好难
    var n,k:longint;
    s:extended;
    begin
    readln(k);
    n:=0;
    s:=0;
    repeat
    inc(n);
    s:=s+1/n;
    until s>k;
    writeln(n);
    end.

  • -1
    @ 2016-01-31 09:00:05

    打表大法好!!!标准o(n)算法,不是的话我认作你爹
    var
    i:longint;
    a:array[1..15]of longint=(2,4,11,31,83,227,616,1674,4550,12367,33617,91380,248397,675214,1835421);

    begin
    readln(i);
    writeln(a[i]);
    end.

  • -1
    @ 2016-01-28 15:05:07

    #include<iostream>
    #include<cmath>

    using namespace std;

    int main()
    {
    float sn=0,k,n=0;
    cout<<"请输入K值:";cin>>k;
    while(sn<=k)
    {n+=1;
    sn=sn+(1/n);

    }
    cout<<"n最小为:"<<n<<endl;
    return 0;

  • -1
    @ 2015-06-13 16:08:59

    program zdfei;
    var
    k:array[0..17]of longint;
    n:integer;
    begin
    readln(n);
    k[1]:=2;k[2]:=4;k[3]:=11;k[4]:=31;
    k[5]:=83;k[6]:=227;k[7]:=616;k[8]:=1674;k[9]:=4550;
    k[10]:=12367;k[11]:=33617;k[12]:=91380;k[13]:=248397;
    k[14]:=675214;k[15]:=1835421;
    writeln(k[n]);
    end.
    打表~

信息

ID
1127
难度
4
分类
模拟 点击显示
标签
递交数
10606
已通过
4818
通过率
45%
被复制
35
上传者