DarkMoon_Dragon @ 2016-08-16 17:24:11
#include<iostream>
using namespace std;
int main()
{
int n,sum=0,m=1,k=1,tian=1,i;
cin>>n;
for(i=1;i<=n;i++)
{ sum=sum+m;
if(tian==k)m++,k++,tian=0;
tian++;
}
cout<<sum;
}
一个循环搞定 (* ̄▽)u┌┐d(▽ ̄*)
by jiangzhy @ 2016-08-20 10:52:18
沙发
by arklight @ 2016-08-21 17:56:47
#include<iostream>
using namespace std;
int main()
{
int k,j,i,sum1=0,sum2=0;cin>>k;
for(i=1;sum1<=k-i;++i)sum1+=i;
for(j=1;j<i;j++)
{
sum2+=j*j;
}
cout<<sum2+(k-sum1)*(j);
}
by MakiseKurisu_ @ 2016-09-07 20:36:59
Pascal【求翻译!】
by 丁镜脯 @ 2016-09-15 17:16:41
var
n,i,j,s:longint;
begin
readln(n);
while n>0 do begin
i:=i+1;
if n>=i then begin
for j:=1 to i do s:=s+i;
n:=n-i;
end else begin
for j:=1 to n do s:=s+i;
n:=0;
end;
end;
writeln(s);
end.
by Alextokc @ 2016-10-21 19:47:16
可以的,不错。
by GQL666 @ 2016-10-24 18:55:40
66666666666666666666
我NOIP正好做的这道题,。、。
程序完美AC,但用PASCAL开了1000000000,
爆了。
wuwuwuwu
by Reaepita @ 2016-10-28 21:15:41
#include<iostream>
using namespace std;
int main()
{
int a,s=0,i,tian=0;
cin>>a;
for(i=1;(i+1)*i/2<=a;i++)
{
s=s+i*i;
}i-=1;
s=s+(a-i*(i+1)/2)*(i+1);
cout<<s;
}
by DarkMoon_Dragon @ 2016-10-28 21:16:08
@包航 智障
by Kelin @ 2016-11-27 08:08:18
你告诉我这是最简单做法kidding me ??