POJ 3349 Snowflake Snow Snowflakes

Source: Internet
Author: User

Snowflakesnowsnowflakes
Time Limit: 4000MS Memory Limit: 65536K
Total Submissions: 35235 Accepted: 9266

Description

You may have heard and snowflakes are alike. Your task is to write a program to determine whether the is really true. Your program would read information about a collection of the snowflakes, and search for a pair, the May is identical. Each snowflake have six arms. For each snowflake, your program is provided with a measurement of the length of each of the six arms. Any pair of snowflakes which has the same lengths of corresponding arms should be flagged by your program as possibly IDE Ntical.

Input

The first line of input would contain a single integer n, 0 < n ≤100000, and the number of snowflakes to Follow. This is being followed byn lines and each describing a snowflake. Each snowflake would be described by a line containing six integers (each integer was at least 0 and less than 10000000), th e lengths of the arms of the snow Ake. The lengths of the arms would be given on order around the snowflake (either clockwise or counterclockwise), but they may b Egin with any of the six arms. For example, the same snowflake could is described as 1 2 3 4 5 6 or 4 3 2 1 6 5.

Output

If all of the snowflakes is distinct, your program should print the message:
No. Snowflakes is alike.
If There is a pair of possibly identical snow akes, your program should print the message:
Twin snowflakes found.

Sample Input

21 2 3 4 5 64 3 2 1 6 5

Sample Output

Twin snowflakes found.

Source

CCC 2007


Accode

#include <map> #include <queue> #include <cmath> #include <cstdio> #include <cstring># Include <stdlib.h> #include <iostream> #include <algorithm> #define MAXN 99809using namespace Std;int    hash[maxn];struct sonw{int a[6];        int in () {int sum=0;            for (int i=0;i<6;++i) {scanf ("%d", &a[i]);        Sum+=a[i];    } return SUM%=MAXN; }};    SONW m[maxn][2],t;int CMP (sonw x, sonw y) {int st,i,j;        for (St =0;st<6;st++) {for (i=st,j=0;j<6;j++,i= (i+1)%6) {if (X.a[i]! = Y.a[j]) break;     } if (j==6) return 1; } for (st=0;st<6;st++) {for (i=st,j = 0; J < 6; J + +, I = (i + 5)% 6) {if (X.a[i]!=y.a[j]) Brea        K     } if (j==6) return 1; } return 0;}    int main () {int n;    scanf ("%d", &n);    int POS;    BOOL Flag=true;       while (n--) {pos=t.in ();        cout<<pos<< ' \12 '; if (flag) {for (inT j=0;j

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

POJ 3349 Snowflake Snow Snowflakes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.