题目链接: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)的更多相关文章

  1. ACM学习历程—UESTC 1218 Pick The Sticks(动态规划)(2015CCPC D)

    题目链接:http://acm.uestc.edu.cn/#/problem/show/1218 题目大意就是求n根木棒能不能放进一个容器里,乍一看像01背包,但是容器的两端可以溢出容器,只要两端的木 ...

  2. ACM学习历程—UESTC 1217 The Battle of Chibi(递推 && 树状数组)(2015CCPC C)

    题目链接:http://acm.uestc.edu.cn/#/problem/show/1217 题目大意就是求一个序列里面长度为m的递增子序列的个数. 首先可以列出一个递推式p(len, i) =  ...

  3. ACM学习历程—UESTC 1222 Sudoku(矩阵)(2015CCPC H)

    题目链接:http://acm.uestc.edu.cn/#/problem/show/1226 题目大意就是构造一个行列和每个角的2*2都是1234的4*4矩阵. 用dfs暴力搜索,不过需要每一步进 ...

  4. ACM学习历程—UESTC 1226 Huatuo's Medicine(数学)(2015CCPC L)

    题目链接:http://acm.uestc.edu.cn/#/problem/show/1226 题目就是构造一个对称的串,除了中间的那个只有1个,其余的两边都是对称的两个,自然答案就是2*n-1. ...

  5. ACM学习历程—UESTC 1219 Ba Gua Zhen(dfs && 独立回路 && xor高斯消元)

    题目链接:http://acm.uestc.edu.cn/#/problem/show/1219 题目大意是给了一张图,然后要求一个点通过路径回到这个点,使得xor和最大. 这是CCPC南阳站的一道题 ...

  6. ACM Secrete Master Plan

    Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a pocket. T ...

  7. 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 ...

  8. 2015南阳CCPC A - Secrete Master Plan 水题

    D. Duff in Beach Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Master Mind KongMing gave ...

  9. hdu 5540 Secrete Master Plan(水)

    Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed × matrix, but ...

随机推荐

  1. 贝塞尔曲线与CAShapeLayer的关系以及Stroke动画

    1.贝塞尔曲线与CAShapeLayer的关系    1.1CAShapeLayer须要一个形状才干生效,贝塞尔曲线能够创建基于矢量的路径.进而能够给CAShapeLayer提供路径,路径会闭环.   ...

  2. php修改密码

      为了让页面更为好看一些,我一般会选择bootstrap,写起来虽然看着麻烦,但是我们真正需要的只有中间的内容  下面是html的内容 <div id="tbx"" ...

  3. 开关openCV

    #include <cv.h> #include <highgui.h> #include <stdio.h> //开关 ; void switch_callbac ...

  4. 九度OJ 1255:骰子点数概率 (递归、DP)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:316 解决:29 题目描述: 把n个骰子扔在地上,所有骰子朝上一面的点数之和为S.输入n,打印出S的所有可能的值出现的概率. 输入: 输入包 ...

  5. 九度OJ 1195:最长&最短文本 (搜索)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3144 解决:1156 题目描述: 输入多行字符串,请按照原文本中的顺序输出其中最短和最长的字符串,如果最短和最长的字符串不止一个,请全部输 ...

  6. swift 一句代码补全tableView分割线

    1.swift实现分割线补全 swift一个大进步,只要设置tableView.separatorInset = UIEdgeInsets.zero即可补全分割线, 2.OC实现分割线补全 而在OC中 ...

  7. Apache转发规则的一点注意

    RewriteRule ^studio/$ book.php?mod=studio 这种目录转发, 正常情况下是没问题的. 但是当根目录下存在一个 studio 目录时, apache就不会转发URL ...

  8. Linux安装Nginx使用负载均衡

    1.实验准备准备三台计算机 nginx1 192.168.13.121 作为nginx负载均衡器nginx2 192.168.13.24  web服务,提供一个页面        nginx3 192 ...

  9. 如何下载symfony

    php -r "readfile('https://symfony.com/installer');" > symfony 可能无法下载,:那么你检查一下你的php.ini找 ...

  10. Java实现微信网页授权

    开发前的准备: 1.需要有一个公众号(我这里用的测试号),拿到AppID和AppSecret: 2.进入公众号开发者中心页配置授权回调域名.具体位置:接口权限-网页服务-网页账号-网页授权获取用户基本 ...