| ||||||||||
| 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 | |||||||||
哪位大哥能告诉我这个程序为什么re?在devc++上跑的很好啊……#include <stdio.h>
main()
{
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
static int b[10000000];
long c[500001];
c[0]=0;
long i;
for(i=1;i<500001;i++)
if (c[i-1]>i && b[c[i-1]-i]==0)
{
c[i]=c[i-1]-i;
b[c[i]]=1;
}
else
{
c[i]=c[i-1]+i;
b[c[i]]=1;
}
long n;
scanf("%d",&n);
while (n!=-1)
{
printf("%d\n",c[n]);
scanf("%d",&n);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator