| ||||||||||
| 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 | |||||||||
拙码,分享之#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[])
{
int n,i,sum,init=2,t=0;
scanf("%d",&n);
i=sqrt(n*2.);
sum=(i*i+3*i)/2;
while((sum-=i+1)>n)--i;
n-=sum;
--i;
init+=n/i;
n%=i;
while(t++<i-n)printf("%d ",init++);
++init;
while(n--)printf("%d ",init++);
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator