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

Re:Help! 不知错哪了

Posted by cuiwj871128 at 2008-10-26 14:47:34 on Problem 1552
In Reply To:Help! 不知错哪了 Posted by:1987 at 2005-03-31 13:34:11
> #include <iostream.h>
> void main()
> {
> 	int a;
> 	int sum;
> 	int b[16];
> 	while(1)
> 	{
> 		for(int i=0;i<=15;i++)
> 		{
> 			cin>>a;
> 			if(a==-1)
> 			return;
> 			b[i]=a;
> 			if(a==0)
> 			break;
> 		
> 		}
> 		sum=0;
> 		for(i=0;i<=15;i++)
> 		{
> 			if(b[i]==0)
> 			break;
> 			for(int j=i+1;j<=15;j++)
> 			{
> 				if(b[j]==0)
> 					break;
> 				if(b[i]==b[j]*2||b[i]*2==b[j])
> 				sum++;
> 			}
> 		}
> 		cout<<sum<<endl;
> 	}
> 
> }

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