Secrete Master Plan

Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others)
 
 

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

Input

The first line of the input gives the number of test cases, T(1≤T≤104). T test cases follow. Each test case contains 4 lines. Each line contains two integers ai0 and ai1 (1≤ai0,ai1≤100). The first two lines stands for the original plan, the 3rd and 4th line stands for the plan Fei opened.

Output

For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is either "POSSIBLE" or "IMPOSSIBLE" (quotes for clarity).

Sample input and output

Sample Input Sample Output
4
1 2
3 4
1 2
3 4 1 2
3 4
3 1
4 2 1 2
3 4
3 2
4 1 1 2
3 4
4 3
2 1
Case #1: POSSIBLE
Case #2: POSSIBLE
Case #3: IMPOSSIBLE

题解:要善于把复杂问题简单化,而不是复杂化,自己用数组模拟了半天,好神经;

代码:

 #include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int INF=0x3f3f3f3f;
int main(){
int a,b,c,d,x,y,z,w;
int T,cnt=;
scanf("%d",&T);
while(T--){
scanf("%d%d%d%d",&b,&a,&c,&d);
scanf("%d%d%d%d",&y,&x,&z,&w);
bool t1=(a==x&&b==y&&c==z&&d==w);
bool t2=(a==y&&b==z&&c==w&&d==x);
bool t3=(a==z&&b==w&&c==x&&d==y);
bool t4=(a==w&&b==x&&c==y&&d==z);
int flot=;
if(t1||t2||t3||t4)flot=;
printf("Case #%d: ",++cnt);
if(flot)puts("POSSIBLE");
else puts("IMPOSSIBLE");
}
return ;
}

CCPC A(模拟)的更多相关文章

  1. 【HDOJ6666】Quailty and CCPC(模拟)

    题意:给出罚时现场赛的题数和罚时,问是否有在金牌线下取整被卡出,四舍五入卡入的队伍 n<=1e5 思路: #include<bits/stdc++.h> using namespac ...

  2. 2017CCPC秦皇岛 E题String of CCPC&&ZOJ3985【模拟】

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3985 题意: 给定一个字符串,由c和p组成,可以添加c或者p. 串中出现一 ...

  3. ccpc网赛 hdu6705 path(队列模拟 贪心

    http://acm.hdu.edu.cn/showproblem.php?pid=6705 这是比赛前8题过的人数第二少的题,于是就来补了,但感觉并不难啊..(怕不是签到难度 题意:给个图,给几条路 ...

  4. 2016 CCPC 东北地区重现赛

    1. 2016 CCPC 东北地区重现赛 2.总结:弱渣,只做出01.03.05水题 08   HDU5929 Basic Data Structure    模拟,双端队列 1.题意:模拟一个栈的操 ...

  5. HDU 5965 枚举模拟 + dp(?)

    ccpc合肥站的重现...一看就觉得是dp 然后强行搞出来一个转移方程 即 根据第i-1列的需求和i-1 i-2列的枚举摆放 可以得出i列摆放的种类..加了n多if语句...最后感觉怎么都能过了..然 ...

  6. ccpc杭州站 赛后总结

    Ccpc杭州站赛后总结 2017年11月4号五号,我参加了ccpc杭州站的比赛,我的队友是聂少飞和王艳,在4号一点半,举行了比赛开幕式,听着教练代表的发言,听着参赛选手代表的发言,听着志愿者的发言,都 ...

  7. 2017 CCPC 杭州 流水账

    day0: 队内训练ccpc 秦皇岛,敝校自己出的题,感觉一个星期没怎么写代码,手生得很,不出意料被打飞了. day1 (热身赛): 热身赛还算顺利,A题看有的队几分钟就草过去了,还以为又是西安ICP ...

  8. CodeForces 731B Coupons and Discounts (水题模拟)

    题意:有n个队参加CCPC,然后有两种优惠方式,一种是一天买再次,一种是买两天,现在让你判断能不能找到一种方式,使得优惠不剩余. 析:直接模拟,如果本次是奇数,那么就得用第二种,作一个标记,再去计算下 ...

  9. 模拟赛小结:2014-2015 ACM-ICPC, NEERC, Southern Subregional Contest

    2014-2015 ACM-ICPC, NEERC, Southern Subregional Contest 2019年10月11日 15:30-20:30(Solved 6,Penalty 740 ...

随机推荐

  1. apache+mysql+php环境的手动搭建

    一.搭建Apache Http Server 官方下载地址:http://www.apachehaus.com/cgi-bin/download.plx 搭建环境:win10 64位 WIN10 64 ...

  2. 删除除了 id 号不同,其他都相同的学生冗余信息

    删除除了 id 号不同,其他都相同的学生冗余信息2.学生表 如下:id 号 学号 姓名 课程编号 课程名称 分数1 2005001 张三 0001 数学 692 2005002 李四 0001 数学 ...

  3. 新视野OJ 2705 [SDOI2012]Longge的问题 (数论)

    传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2705 题解:求 sigma(gcd(i,n), 1<=i<=n<2^32) ...

  4. Android常用工具类封装---SharedPreferencesUtil

    SharedPreferences常用于保存一些简单的数据,如记录用户操作的配置等,使用简单. public class SharedPreferencesUtil {              // ...

  5. PHP无法获取Referer问题排查

    测试结果: 同一个页面,2次打开,第一次能获取到Referer第二次获取不到,很好奇原因所在. test1.php代码是: <?php echo '测试来源:直接载入页面<br/>' ...

  6. 虚拟机NAT模式主机ping不通虚拟机解决方案

    本篇没有抓包,只是简单一个实施.需要的童鞋可以拿走这个方法. 虚拟机与真机通信三种模式, 桥接模式,NAT 模式 ,HOST 模式. 桥接就是在真机的网络上模拟一个网卡,给虚拟机申请一个和真机在同一个 ...

  7. 经典灰鸽子lcx

    方法1路由配置 在路由器配置 进入虚拟服务器 填入ip 端口 就可以了方法2内网域名解析想以前的花生客 科迈都有这项免费业务但现在基本不提供了如果那个网站还有内网解析的功能 大家一定要发上来哦方法3p ...

  8. Qt qss一些伪装态,以及margin与padding区别

    伪状态    描述 :checked    button部件被选中:disabled    部件被禁用:enabled    部件被启用:focus    部件获得焦点:hover    鼠标位于部件 ...

  9. 【基础】常用的机器学习&数据挖掘知识点

    Basis(基础): MSE(Mean Square Error 均方误差),LMS(LeastMean Square 最小均方),LSM(Least Square Methods 最小二乘法),ML ...

  10. C++中搜索、截取字符串

    演示样例中有具体凝视,直接上代码: #include <iostream> #include <string> using std::cout; using std::endl ...