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

help!!!!!

Posted by 00448152 at 2005-03-17 14:07:25 on Problem 1552
#include<iostream.h>
void main()
{
	int i,j,a[15];
	int num=0,n=0;
	for(i=0;i<15;i++)
	{
		cin>>a[i];
		if(a[i]==0||a[i]==-1)
			break;
		n++;
	}
	while(a[0]!=-1)
	{
		
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if((a[i]==2*a[j])||(2*a[i]==a[j]))
				num++;
		}
	}
		cout<<num<<endl;
	num=0;
	n=0;
	for(i=0;i<15;i++)
	{
		cin>>a[i];
		if(a[i]==0||a[i]==-1)
			break;
		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