Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我看了大数组还是不会!!!!!!!!!!!!!--2081

Posted by 90405129 at 2004-12-21 19:10:07
In 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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator