哪里出问题了,全WA(C语言)

P1035 [NOIP2002 普及组] 级数求和

UTAsriel @ 2022-10-08 16:35:37


#include <stdio.h>
int main(){
    double m=0;
    double n=0;
    int k;
    scanf("%d",&k);
    while(k>=m){
        n++;
        m=m+(1/n);
        }
    printf("%d",n);
    return 0;
}

by Magus @ 2022-10-08 16:51:55

正整数


by cxk233 @ 2022-10-17 20:36:39

@TX_Bernie 麻烦再好好看看题目······

S_n$ = $1+\frac{1}{2}+\frac{1}{3}+…+\frac{1}{n}

by Magus @ 2022-10-18 21:47:01

@fengyuanwanye ohwssb


|