A
来源:互联网 发布:php curl异步请求 编辑:程序博客网 时间:2024/05/29 10:01
Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a pocket. The plan instructs how to deploy soldiers on the four corners of the city wall. Unfortunately, when Fei opened the pocket he found there are only four numbers written in dots on a piece of sheet. The numbers form 2×2 2×2 matrix, but Fei didn't know the correct direction to hold the sheet. What a pity!
Given two secrete master plans. The first one is the master's original plan. The second one is the plan opened by Fei. As KongMing had many pockets to hand out, he might give Fei the wrong pocket. Determine if Fei receives the right pocket.
Given two secrete master plans. The first one is the master's original plan. The second one is the plan opened by Fei. As KongMing had many pockets to hand out, he might give Fei the wrong pocket. Determine if Fei receives the right pocket.
(starting from 1) and
41 23 41 23 41 23 43 14 21 23 43 24 11 23 44 32 1
Case #1: POSSIBLECase #2: POSSIBLECase #3: IMPOSSIBLECase #4: POSSIBLE
首先这道题的题意就是要我们输入两个2*2的矩阵,通过变换看这两个矩阵是否相等。这个题没啥技巧,
就是四个数字去对比。我当时做的时候还想有什么技巧,想了半天没想出来,最后还是老老实实的用4个if语句。
#include <iostream>#include <cstdio>using namespace std;int main(){ int T,counts=1; scanf("%d",&T); int a[4][4],b[4][4]; while(T--) { for(int i=1;i<=2;i++) for(int j=1;j<=2;j++) scanf("%d",&a[i][j]); for(int i=1;i<=2;i++) for(int j=1;j<=2;j++) scanf("%d",&b[i][j]); int flag=0; if(a[1][1]==b[1][1]&&a[1][2]==b[1][2]&&a[2][1]==b[2][1]&&a[2][2]==b[2][2]) flag=1; else if(a[1][1]==b[2][1]&&a[1][2]==b[1][1]&&a[2][1]==b[2][2]&&a[2][2]==b[1][2]) flag=1; else if(a[1][1]==b[2][2]&&a[1][2]==b[2][1]&&a[2][1]==b[1][2]&&a[2][2]==b[1][1]) flag=1; else if(a[1][1]==b[1][2]&&a[1][2]==b[2][2]&&a[2][1]==b[1][1]&&a[2][2]==b[2][1]) flag=1; if(flag) { printf("Case #%d: POSSIBLE\n",counts++); } else { printf("Case #%d: IMPOSSIBLE\n",counts++); } } return 0;}
阅读全文
0 0
- a
- a
- a
- a
- a
- a
- a
- a
- a
- a
- a
- a
- a
- A
- A*
- a
- A
- a
- 使用XWalkView 替换 WebView控件
- python 判断是否存在某个文件
- Java8 lambda表达式10个示例
- Uva 12304 2D Geometry 110 in 1!(圆综合题)
- node解决安装包后xx-v命令无效
- A
- Hibernate java.lang.StackOverflowError异常解决
- 小程序--导航栏篇
- Android接入微信支付踩过的坑
- CSocket详解
- DSP中断PIE控制器
- 网络请求HttpClient,Socket,WebSocket
- Centos7 docker pull 镜像报错:failed to register layer: devmapper
- 相对布局的控件布局