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

边看电影边写代码,竟然一次 0 MS AC,黄河之水天上来~

Posted by gfedcba at 2009-01-12 22:40:27 on Problem 1552
#include <iostream>
using namespace std;

int main()
{
    bool have[100];
	
	int arr[15];
	int i, j;
	int count ; 
	while (cin>>arr[0] && arr[0]!=-1)
	{
	
		memset(have, false, sizeof(have));
		have[arr[0]] = true;
		count = 0;
		i=1;

		while (cin>>arr[i] && arr[i]!=0)
		{
			have[arr[i]] = true;
			i++;
		}

		for (j=0; j<=i-1; j++)
		{

			if (arr[j]%2==0 && have[arr[j]/2])
			{
				count++;
			}
		}
		cout<<count<<endl;

	}
    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