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

为什么“哇”了,数据都过了

Posted by xiaolijian at 2010-07-28 09:19:16 on Problem 1552
#include<stdio.h>
#define N 100

int main()
{
	int a[N]={1},i,j,count=0,n=0;
	
	while(1)
	{
		count=0;
		for(i=0;a[i]!=0;i++)
		{
			scanf("%d",&a[i+1]);
			if(a[1]==-1)
				goto end;
		}
		n=i;
	
		for(i=1;i<n-1;i++)
		{
			for(j=2;j<n;j++)
			{
				if(a[j]==2*a[i])
				{
					count++;
				}
			}
		}
		printf("%d\n",count);	
	}
	end:
		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