him0715 @ 2022-06-13 21:30:11
#include <bits/stdc++.h>
using namespace std;
int main(){
int k,coin=0;
cin>>k;
for(int i=1;i<=k;i++){
if(i*i<=k)coin+=i;
}
cout<<coin<<endl;
return 0;
}
by RNTBW @ 2022-06-13 21:33:52
过样例了吗
by 3a51_ @ 2022-06-13 21:39:11
@him0715 拿样例来说,
by RNTBW @ 2022-06-13 21:41:35
对,得开一个变量