UVALive 4264 Message(Regionals 2008 :: Asia - Taipei+模拟)
来源:互联网 发布:手机淘宝我的分享 编辑:程序博客网 时间:2024/05/22 08:05
【题目链接】:click here~~
【题目大意】给你n个10*10 的01组成的图像,再给你一个匹配图像,其中匹配图像可以看做是前面n个图像通过0,90,270,360度旋转得到,其中如果图像失真数小于20以内可以忽略,问匹配图像可以由前面那几个图像旋转得到。
【思路】:比赛的时候由没有看清楚题意,其实看懂了题目就很简单,直接模拟即可。
代码:
/** Problem: UVALive 4264* Running time: 46MS* Complier: G++* Author: javaherongwei* Create Time: 20:16 2015/10/14 */#include <bits/stdc++.h>using namespace std;const int maxn=111;const int inf=0x3f3f3f3f;inline int max(int a,int b){return a>b?a:b;}inline int min(int a,int b){return a<b?a:b;}int alpq[maxn][11][11];int a[11][11];void Rotate(){ int c[11][11]; for(int i=1; i<=10; ++i) for(int j=1; j<=10; ++j) c[10-j+1][i]=a[i][j]; for(int i=1; i<=10; ++i) for(int j=1; j<=10; ++j) a[i][j]=c[i][j];}int Function(int b[11][11]){ int s=0; for(int i=1; i<=10; ++i) for(int j=1; j<=10; ++j) if(b[i][j]!=a[i][j]) s++; return s;}int main(){ //freopen("1.txt","r",stdin); int t; while(cin>>t&&t) { char op[65]; for(int k=1; k<=t; ++k) { cin>>op[k]; for(int i=1; i<=10; ++i) for(int j=1; j<=10; ++j) scanf("%1d",&alpq[k][i][j]); } int tt,res; cin>>tt; for(int k=1; k<=tt; ++k) { for(int i=1; i<=10; ++i) for(int j=1; j<=10; ++j) scanf("%1d",&a[i][j]); for(int i=1; i<=t; ++i)//枚举t个原来的图像 { for(int z=1; z<=4; ++z)//枚举四个旋转方向 { int ck=Function(alpq[i]); if(ck<=20) { res=i; } Rotate(); } } printf("%c",op[res]); } cout<<endl; } return 0;}/*Sample Input2a0000000000011111111001111100110111111100000011000000001100000001111100001111111000000000000000000000X01100001100110000110001100110000110011000001111000000111100000110011000011001100011000011001100001103011000011001100001100011001100001100110000011110000001111000001100110000110011000110000110011000011000000000001100000011111100111100111111000000110000000011000000111111001111001111110000001100000000000000000000000000111011100011100000110001001111111000111111100011001010001100101000100001100000000010Sample OutputXXa*/
0 0
- UVALive 4264 Message(Regionals 2008 :: Asia - Taipei+模拟)
- UVALive 4260 Fortune Card Game (Regionals 2008 Asia Taipei +DP)
- Uvalive 4267 Finding The Heaviest Path (Regionals 2008 Asia Taipei +DFS结点最大权值路径)
- UVALive Problem 7454 Parentheses——Regionals 2015 :: Asia - Taipei
- UVALive Problem 7457 Discrete Logarithm Problem——Regionals 2015 :: Asia - Taipei
- UVALive Problem 7456 Least Crucial Node——Regionals 2015 :: Asia - Taipei
- Regionals 2015 :: Asia - Taipei 部分题解
- UVALive 4264 Message (模拟)
- UVALive - 4264 Message (模拟)
- Regionals 2015 :: Asia - Taipei B Linear Ecosystem 高斯消元(真模板)
- Regionals 2015 :: Asia - Taipei C - Least Crucial Node 割点应用
- Regionals 2009 Asia - Hsinchu UVALIVE, 4525 - Clues 搜索
- Regionals 2009 Asia - Hsinchu uvalive 4526 Inventory - dp
- Regionals 2009 :: Asia - Hsinchu UVALIVE, 4527 Vaccination Centers - 搜索剪枝
- Regionals 2011, Asia (二分图匹配)
- Regionals 2014 >> Asia - Tehran >> 7017 - Working Hours【模拟】
- Regionals 2009 >> Asia - Hsinchu UVALIVE, 4528 Schedule Pairs of Jobs - 搜索回溯
- Regionals 2009 >> Asia - Hsinchu UVALIVE, 4529 A Constrained Queen Game - 搜索剪枝
- Hadoop二次排序
- KVC 和 KVO 的使用场景
- 【C语言深入】[001] static 关键字:
- Skype for Business iOS版正式发布
- 对Hadoop二次排序的理解
- UVALive 4264 Message(Regionals 2008 :: Asia - Taipei+模拟)
- [sicily]1153. 马的周游问题
- 黑马程序员——java集合框架——List接口
- 思想
- jsp页面加载时自动执行action
- 101 php 正则表达式
- Java并发编程:Timer和TimerTask
- Mybatis中的常用sql
- 圆与任意多边形交的长度