36pts求助

P1035 [NOIP2002 普及组] 级数求和

yjy_fywy @ 2024-12-18 19:29:41

#include <bits/stdc++.h>
using namespace std;
int main(){
    double k,sum=0,ans=0;
    cin>>k;
    for(double i=1;i<=248;i++){
        if(k<sum){
            ans=i-1;
            break;
        }
        sum+=1/i;
    }
    cout<<ans;
    return 0;
}

by codm_man @ 2024-12-19 17:07:29

#include <bits/stdc++.h>
using namespace std;
int main(){
    double k,sum=0,ans=0;
    cin>>k;
    for(double i=1;i<=248;i++){
        if(k<sum){
            ans=i-1;
            break;
        }
        sum+=1/i;
    }
    cout<<ans;
    return 0;
}

@yjy_fywy 求关


by yjy_fywy @ 2024-12-20 19:57:44

@codm_man蟹蟹,壶关不


by codm_man @ 2024-12-24 12:27:16

已壶关 谢谢 @yjy_fywy


by yjy_fywy @ 2024-12-24 21:25:51

@codm_man你也玩codm?


by Chen1102 @ 2024-12-29 10:51:13

@codm_man@codm_man 这也不对啊


by Tenko_awa @ 2025-01-05 12:39:23

@codm_man 你这不是把他的代码原封不动的抄了一遍吗


|