| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
简单公式int f(int n)
{
int k;
int i;
int sum;
k=1;
while((1+k)*(2+k)/2<n)
k++;
sum=0;
for(i=1;i<=k;i++)
sum+=((i+k)*(k-i+1)/2);
sum+=((n-k*(k+1)/2)*(k+1));
return sum;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator