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:一次0MS就AC,分享下代码

Posted by 1152230301 at 2011-07-06 22:06:15 on Problem 1552
In Reply To:一次0MS就AC,分享下代码 Posted by:zjc0823 at 2010-04-14 11:01:17
> #include <iostream>
> #include <algorithm>
> using namespace std;
> 
> int main()
> {
> 	int i,j,x[20],leight,num;
> 	while(cin>>x[0])
> 	{
> 		if(x[0]==-1)
> 			break;
> 		num=0;
> 		leight=1;
> 		while(cin>>x[leight])
> 		{
> 			if(x[leight]==0)
> 				break;
> 			leight++;
> 		}
> 		sort(x,x+leight+1);//x【light】是0,不用排序吧?

> 		for(i=0;i<leight;i++)
> 			for(j=i+1;j<=leight;j++)
> 				if(2*x[i]==x[j])
> 					num++;
> 		cout<<num<<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