zlzlzlzlzl_ @ 2024-12-05 19:47:05
#include <stdio.h>
int main() {
int n, count = 0;
double sum = 0;
int j = 1;
double temp;
scanf("%d", &n);
while (sum < n) {
temp = 1.0 / j;
sum += temp;
count++;
j++;
}
printf("%d", count);
return 0;
}
为啥80分 没过 求解
by yise @ 2024-12-05 19:50:45
@zlzlzlzlzl_ 第8行 sum<=n
by zlzlzlzlzl_ @ 2024-12-05 20:05:56
@yise 感谢哥 已解决