5 solutions

  • 1
    @ 2026-1-26 17:31:19
    int main()
    {
        int n,k;
        double sum=0.0;
        scanf("%d",&k);
        if(k==1)
        {
            n=2;
        }
        else if(k>1)
        {
            n=1;
            do
            {
                sum += 1.0/n;
                n++;
            }
            while(sum<k);
        }
        printf("%d",n);
        return 0;
    }
    
    

    Information

    ID
    6753
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    7
    Tags
    (None)
    # Submissions
    498
    Accepted
    101
    Uploaded By