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:更暴力。不解释

Posted by nenu10_52 at 2012-02-03 10:26:45 on Problem 3349
In Reply To:更暴力。不解释 Posted by:stupidjohn at 2010-11-16 20:45:49
> #include<iostream>
> #include<cstdio>
> #include<algorithm>
> using namespace std;
> bool flag;
> struct node
> {
> 	int edge[6];
> 	void isort()
> 	{
> 		sort(edge,edge+6);
> 	}
> 	void get()
> 	{
> 		scanf("%d%d%d%d%d%d",&edge[0],&edge[1],&edge[2],&edge[3],&edge[4],&edge[5]);
> 	}
> }snow[100005];
> bool cmp(struct node a,struct node b)
> {
> 	for(int i=0;i<6;i++)
> 	{
> 		if(a.edge[i]==b.edge[i]) continue;
> 		return a.edge[i]<b.edge[i];
> 	}
> 	flag=true;
> 	return true;
> }
> int main()
> {
> 	int n;
> 	register int i;
> 	while(scanf("%d",&n)!=EOF)
> 	{
> 		for(i=0;i<n;i++)
> 		{
> 			snow[i].get();
> 			snow[i].isort();
> 		}
> 		flag=false;
> 		sort(snow,snow+n,cmp);
> 		if(flag) printf("Twin snowflakes found.\n");
> 		else printf("No two snowflakes are alike.\n");
> 	}
> 	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