ACM学习历程—UESTC 1215 Secrete Master Plan(矩阵旋转)(2015CCPC A)
题目链接:http://acm.uestc.edu.cn/#/problem/show/1215
题目大意就是问一个2*2的矩阵能否通过旋转得到另一个。
代码:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#define LL long long using namespace std; struct Matrix
{
int v[][]; void get()
{
for (int i = ; i < ; ++i)
for (int j = ; j < ; ++j)
scanf("%d", &v[i][j]);
} void turn()
{
swap(v[][], v[][]);
swap(v[][], v[][]);
swap(v[][], v[][]);
} bool operator==(const Matrix x) const
{
for (int i = ; i < ; ++i)
for (int j = ; j < ; ++j)
if (v[i][j] != x.v[i][j])
return false;
return true;
}
}a, b; void input()
{
a.get();
b.get();
bool flag = false;
for (int i = ; i < ; ++i)
{
b.turn();
if (a == b)
{
flag = true;
break;
}
}
if (flag) printf("POSSIBLE\n");
else printf("IMPOSSIBLE\n");
} int main()
{
//freopen("test.in", "r", stdin);
int T;
scanf("%d", &T);
for (int times = ; times <= T; ++times)
{
printf("Case #%d: ", times);
input();
}
return ;
}
ACM学习历程—UESTC 1215 Secrete Master Plan(矩阵旋转)(2015CCPC A)的更多相关文章
- ACM学习历程—UESTC 1218 Pick The Sticks(动态规划)(2015CCPC D)
题目链接:http://acm.uestc.edu.cn/#/problem/show/1218 题目大意就是求n根木棒能不能放进一个容器里,乍一看像01背包,但是容器的两端可以溢出容器,只要两端的木 ...
- ACM学习历程—UESTC 1217 The Battle of Chibi(递推 && 树状数组)(2015CCPC C)
题目链接:http://acm.uestc.edu.cn/#/problem/show/1217 题目大意就是求一个序列里面长度为m的递增子序列的个数. 首先可以列出一个递推式p(len, i) = ...
- ACM学习历程—UESTC 1222 Sudoku(矩阵)(2015CCPC H)
题目链接:http://acm.uestc.edu.cn/#/problem/show/1226 题目大意就是构造一个行列和每个角的2*2都是1234的4*4矩阵. 用dfs暴力搜索,不过需要每一步进 ...
- ACM学习历程—UESTC 1226 Huatuo's Medicine(数学)(2015CCPC L)
题目链接:http://acm.uestc.edu.cn/#/problem/show/1226 题目就是构造一个对称的串,除了中间的那个只有1个,其余的两边都是对称的两个,自然答案就是2*n-1. ...
- ACM学习历程—UESTC 1219 Ba Gua Zhen(dfs && 独立回路 && xor高斯消元)
题目链接:http://acm.uestc.edu.cn/#/problem/show/1219 题目大意是给了一张图,然后要求一个点通过路径回到这个点,使得xor和最大. 这是CCPC南阳站的一道题 ...
- ACM Secrete Master Plan
Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a pocket. T ...
- The 2015 China Collegiate Programming Contest A. Secrete Master Plan hdu5540
Secrete Master Plan Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Othe ...
- 2015南阳CCPC A - Secrete Master Plan 水题
D. Duff in Beach Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Master Mind KongMing gave ...
- hdu 5540 Secrete Master Plan(水)
Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed × matrix, but ...
随机推荐
- sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
- 1、Codevs 必做:2833、1002、1003、2627、2599
2833 奇怪的梦境 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题解 题目描述 Description Aiden陷入了一个奇怪的梦境:他被困 ...
- 【BZOJ1038】[ZJOI2008]瞭望塔 半平面交
[BZOJ1038][ZJOI2008]瞭望塔 Description 致力于建设全国示范和谐小村庄的H村村长dadzhi,决定在村中建立一个瞭望塔,以此加强村中的治安.我们将H村抽象为一维的轮廓.如 ...
- 如何使用EasyNVR+CDN突破萤石云在直播客户端数量上的限制,做到低成本高性价比的直播
恰逢五一假期,有以为来自内蒙的用户向我电话咨询,大概的场景是这样的: 目前用户使用的是全套的海康IPC和NVR设备: 海康NVR设备通过设置萤石云平台,由萤石云对外提供直播服务: 萤石云对单个摄像机同 ...
- Django之restframework2视图三部曲
视图三部曲 下面我来来看restframework是如何将冗余的代码一步步的进行封装. 这里主要用到的是多继承 第一步mixin类编写视图 AuthorModelSerializer: class A ...
- test_bdc
[转]REPORT zbdc_test_by_shir. * 定义个BDC格式的内表**************************************************DATA : B ...
- ABAP服务器文件操作
转自http://blog.itpub.net/547380/viewspace-876667/ 在程序设计开发过程中,很多要对文件进行操作,这又分为对本地文件操作和服务器文件操作.对本地文件操作使用 ...
- python基础11 ---函数模块1
函数模块 一.函数模块的作用(为什么要有函数模块) 1.函数模块可以减少代码量 2.函数模块方便阅读 3.函数模块维护性强二.函数模块的本质以及调用方法 1.函数模块的本质就是一个.py结尾的文件,该 ...
- eclipse 修改 JDK中的src.zip的路径
http://blog.sina.com.cn/s/blog_54a1bca7010112fb.html http://www.douban.com/note/211369821/ 1.点 “wind ...
- iOS 8以后 定位手动授权问题
ios8以后 都是手动授权定位权限 不过不处理这块 在ios8以后的系统就会默认永不授权 即关闭了定位权限 处理办法如下 .导入框架头文件 #import <CoreLocation/CoreL ...