欢迎使用本站,预祝练习时长两年半的选手们到成功! [本模块信息来自tem/def/head]

2022:【例4.7】最小n值

时间:2024-06-21 16:01 作者:lizq 点击:
#include iostreamusing namespace std;int main(){ int a; double b=1; double c=0; cina; while(ca){ c=c+1/b; b=b+1; } coutb-1; return 0;}
#include <iostream>
using namespace std;
int main(){
    int a;
    double b=1;
    double c=0;
    cin>>a;
    while(c<a){
        c=c+1/b;
        b=b+1;
    }
    cout<<b-1;
    return 0;
}


(责任编辑:lizq)
    顶一下
    (0)
    0%
    踩一下
    (0)
    0%