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

急急急急。。。高手指点:为什么我这个程序总是Output limit Exceeded?

Posted by d20061988 at 2008-07-30 14:27:56 on Problem 2234
#include<stdio.h> 
int main()
{
	int n,*p,i,j,temp,sum,b;
    int q[25];
	while(scanf("%d",&n)&&n<=20){
	sum=0;
	p=new int[n];
	for(i=0;i<n;i++)
	{scanf("%d",&b);if(b>10000000) return 0;p[i]=b;}
	for(j=0;j<n;j++)
	{
		if(j==0){
		for(i=0;i<25;i++)
 		{
 			q[i]=p[j]%2;
 			p[j]/=2;
 		}
		}
		else{
              	for(i=0;i<25;i++)
		{   temp=q[i];
 			     q[i]=p[j]%2;
				 q[i]=temp^q[i];
 			     p[j]/=2;
 		}
		}
	}
		  for(i=0;i<25;i++)
			  if(q[i]==1) {sum=1;goto success;}
success:
			  if(sum==0&&n!=1)  printf("No \n");
          else  printf("Yes \n");
		  }

		  return 0;
}

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