| ||||||||||
| 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>
int main()
{
int n,i,j,a[50];
scanf("%d",&n);
for(i=2;n>=i;i++)
{
a[i-2]=i;
n-=i;
}
for(j=49;j>=0;j--)
{
if(a[j]>0&&n>0)
{
a[j]++;n--;
}
}
if(n>0)
{
for(j=49;j>=0;j--)
if(a[j]>0&&n>0)
a[j]++;n--;
}
for(i=0;i<49&&a[i]>0;i++)
printf("%d ",a[i]);
puts("");
return(0);
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator