| ||||||||||
| 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 | |||||||||
我看了大数组还是不会!!!!!!!!!!!!!--2081In Reply To:2081----!!一定要看看阿!!为什么总是超时??? Posted by:90405129 at 2004-12-20 20:30:37 #include<stdio.h>
int i,n,m,j;
int a[500000];
void main(){
for(i=1,a[0]=0;i<=5000000;i++){
a[i]=a[i-1]-i;
if(a[i]<=0) a[i]=a[i-1]+i;
for(j=0;j<i;j++)
if(a[i]==a[j]) a[i]=a[i-1]+i
scanf("%d",&n);
if(n==-1)break;
else printf("%d\n",a[n]);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator