2 solutions

  • 0
    @ 2023-10-25 15:40:04
    #include<math.h>
    #pragma warning(disable:4996) 
    int main()
    {
        int k, n = 1;
        double sum = 0;
        scanf("%d", &k);
        do
        {
            sum = sum + 1.0 / n;
            n++;
        } while (!(sum > k));
        printf("%d", n-1);
        return 0;
    }
    

    Information

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