POJ-3349 思维要全面..
来源:互联网 发布:tracker软件 编辑:程序博客网 时间:2024/06/10 01:37
本题的意思和基本思维和容易~~按一定规则将每个雪花转换成唯一的形状~~然后比较就是了~~可以用Hash也可以排序后比较~~
为了使每个雪花按同一标准转化成唯一~~我是最傻的办法~~将每个雪花所有情况12种找出来~~找出序列最小的~~作为该雪花的关键顺序~~这是最傻的也是最保险的.同时也是最好写的...囧...
Program:
#include<iostream>#include<algorithm>#include<stdio.h>#include<string.h>#include<cmath>#include<queue>#define oo 2000000000#define ll long longusing namespace std;struct node{ int w[8];}s[200000],temp[20];int a[8]; bool f;bool cmp(node a,node b){ int i; for (i=1;i<=6;i++) if (a.w[i]!=b.w[i]) return a.w[i]<b.w[i]; return true;}int main(){ int m,x,y,i,k,n; scanf("%d",&n); for (m=1;m<=n;m++) { for (i=1;i<=6;i++) scanf("%d",&a[i]); k=0; for (i=1;i<=6;i++) { k++; x=i; for (y=1;y<=6;y++) { temp[k].w[y]=a[x]; x++; if (x==7) x=1; } k++; x=i; for (y=1;y<=6;y++) { temp[k].w[y]=a[x]; x--; if (x==0) x=6; } } sort(temp+1,temp+1+k,cmp); for (i=1;i<=6;i++) s[m].w[i]=temp[1].w[i]; } sort(s+1,s+1+n,cmp); f=false; for (i=1;i<n;i++) { for (x=1;x<=6;x++) if (s[i].w[x]!=s[i+1].w[x]) goto A; f=true; break; A: ; } if (f) printf("Twin snowflakes found.\n"); else printf("No two snowflakes are alike.\n"); return 0;}
- POJ-3349 思维要全面..
- 全面考虑 ,修炼思维
- POJ 3154 Graveyard (思维)
- poj 1852思维题
- poj 1852 Ants 【思维】
- poj 1852 Ants (思维)
- poj 2393 贪心 思维
- poj-1852-Ants【思维】
- 思维 POJ-1323
- POJ 2718 搜索+思维
- poj-1664【递归】【思维】
- POJ 1469 - 排列组合的思维..
- poj 2565 Ants (KM+思维)
- poj 1844 Sum ( 数学思维 )
- 练练思维之poj 2356
- POJ 1852 Ants(思维)
- poj 1852 ants 思维题
- POJ 1722(gcd+思维)
- 让wordpress通过SFTP自动更新
- Oracle 常用目录结构(10g) #
- rh436 - iscsi服务端配置(rhel5.5)
- win32汇编头文件的编写注意
- hdu 4018 Parsing URL
- POJ-3349 思维要全面..
- VIM键盘映射 (Map)
- Linux 入门级学习笔记
- Mac技巧之苹果电脑Mac OS X系统上,类似Windows画图板的软件paintbrush介绍与下载
- 深入理解fork()
- POj 1145
- HDU 3835 R(N)
- test xmlrp-c (centOS 5.4编译成功)
- 《教父》经典名言