0分求助c++

P1035 [NOIP2002 普及组] 级数求和

zhangmuxinzhe @ 2023-07-31 11:30:21

#include<iostream>
using namespace std;
int main(){
    int n,max=0;
    cin>>n;
    for(int i=1;i<=1;i++){
        max=max+1/i;
        if(max>n) cout<<i;
    }
    return 0;
}

by Rieman_sum @ 2023-07-31 11:34:25

用double


by Rieman_sum @ 2023-07-31 11:35:44

for(int i=1;i<=1;i++)笑死我了


by 0oOo0 @ 2023-07-31 11:36:02

#include <iostream>
using namespace std;

int main() {
    double n = 0, k, cnt = 1;
    cin >> k;
    while (n <= k)
    {
        n = n + 1.0 / cnt;
        cnt++;
    }
    cout << cnt - 1;
}

by Ice_rnfmabj @ 2023-07-31 11:36:09

i=1;i<=1;i++

???


by 0oOo0 @ 2023-07-31 11:36:40

@Guo1 这不我粉丝吗


by Rieman_sum @ 2023-07-31 11:37:11

@REMENBERNIRVANA 您想表达什么


by 0oOo0 @ 2023-07-31 11:37:25

@Guo1 谢幕。。


by Rieman_sum @ 2023-07-31 11:38:19

@zhangmuxinzhe 想问一下您的黄题是怎么做出来的


by zhangmuxinzhe @ 2023-07-31 11:41:45

@Guo1 wc,我是sb


by Lxz120605 @ 2023-07-31 12:06:57

for(int i=1;i<=1;i++)???????????


| 下一页