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 Joker_lazydoghead @ 2023-07-31 12:21:53

这三道黄题都好水啊@Guo1


by Rieman_sum @ 2023-07-31 12:23:04

@lazy_doghead 三道?


by Joker_lazydoghead @ 2023-07-31 12:35:26

对啊


by Joker_lazydoghead @ 2023-07-31 12:36:18

P1932 P2005 P1923


by zhangbochen @ 2023-11-01 12:39:22

#include<bits/stdc++.h>
using namespace std;
int main(){
    double k,n=1,sn;
    cin>>k;
    while(1){
        sn+=1/n;
        if(sn>k)
            break;
        n++;
    }
    cout<<n;
    return 0;
}

上一页 |