bluetored @ 2022-09-13 20:17:23
#include <stdio.h>
int main ()
{
int n=100000,k;
int i=1,m=0,cnt=0;
scanf ("%d",k);
for(i=1;i<=n;i++)
{
int s=i,p=1;
for (p=1;p<=s;p++)
{
m=m+s;
cnt++;
if(cnt==k) break;
}
if(cnt==k) break;
}
printf("%d",cnt);
return 0;
}
by Li_mz__ @ 2022-09-13 20:19:54
多么简单的一道题那
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b = 0,c = 1,i;
cin>>a;
for(i = 1;i <= a;i++){
a -= i;
b += c * c;
c++;
}
cout<<b + a * c;
return 0;
}
这样就行
by starwu @ 2022-09-13 20:20:12
你的输入没有&
by starwu @ 2022-09-13 20:21:00
@Li_mz__ lz是求调,不是要正解捏
by Li_mz__ @ 2022-09-13 20:22:32
@CRXIS_AK_IOI
哦
谢谢大佬指点
by bluetored @ 2022-09-13 22:00:17
@CRXIS_AK_IOI 感谢大佬感谢大佬
by shengheng @ 2022-10-02 19:33:53
@bluetored
#include<bits/stdc++.h>
using namespace std;
int main(){
//freopen("coin.in","r",stdin);
//freopen("coin.out","w",stdout);
int k,d=0,m=0;
cin>>k;
for(int i=1;i<=k;i++){
for(int j=1;j<=i;j++){
if(d>=k){
break;
}else{
m+=i;
d+=1;
}
}
}cout<<m;
//fclose(stdin);
//fclose(stdout);
return 0;
}