提交时间:2023-11-02 18:54:23
运行 ID: 29725
#include <stdio.h> #include <stdlib.h> int main() { int n, k; double s; scanf("%d", &k); s = 0.0; n = 1; while (1) //死循环 { s = s + 1.0/n; //求s=1+1/2+...+1/n if(s > k) { printf("%d\n", n); break; //跳出死循环 } n++; } return 0; }