啊啊啊

P1035 [NOIP2002 普及组] 级数求和

poor_OIer @ 2022-07-08 21:32:07

哪里错了啊 帮忙看看

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int k;
    cin>>k;
    int ans=0;
    int n=1;
    while(ans<=k)
    {
        n++;
        for(int i=1;i<=n;i++)
        {
            ans=ans+i/n;
        }
    }
    cout<<n;
    return 0;
}

by mxtx @ 2022-07-08 21:35:02

你不知道int除法是向下取整?


by mzyc_yang2021 @ 2022-07-08 21:35:43

@for_i_in_range 嗯,已经删了


by Anomie @ 2022-07-08 21:37:41

@13355628426ab 先系统学一下c++再来求助行不行?你这属于ssd行为


by FQR_ @ 2022-07-08 21:39:32

还有


by FQR_ @ 2022-07-08 21:42:58

@13355628426ab 你倒是吱个声啊


by Missa @ 2022-07-08 22:18:28

1st

2nd

3rd

4th

5th

6th

/qd


上一页 |