The 13th Zhejiang Provincial Collegiate Programming Contest - C
Defuse the Bomb
Time Limit: 2 Seconds Memory Limit: 65536 KB
The bomb is about to explode! Please defuse it as soon as possible!
There is a display showing a number from 1 to 4 on the bomb. Besides this, there are 4 buttons under the display. Each button is labeled by a number from 1 to 4. The numbers on the buttons are always distinct.
There are 5 defusing stages in total. Pressing the correct button can progress the bomb to the next defusing stage. The number on the display and the number on each button may be different in different stages. The bomb will be defused only when all 5 defusing stages get passed. Pressing the incorrect button will cause the bomb to explode immediately. Be careful!
Here is the detailed bomb defusing manual. Button positions are ordered from left to right.
Stage 1:
- If the display is 1, press the button in the second position.
- If the display is 2, press the button in the second position.
- If the display is 3, press the button in the third position.
- If the display is 4, press the button in the fourth position.
Stage 2:
- If the display is 1, press the button labeled "4".
- If the display is 2, press the button in the same position as you pressed in stage 1.
- If the display is 3, press the button in the first position.
- If the display is 4, press the button in the same position as you pressed in stage 1.
Stage 3:
- If the display is 1, press the button with the same label you pressed in stage 2.
- If the display is 2, press the button with the same label you pressed in stage 1.
- If the display is 3, press the button in the third position.
- If the display is 4, press the button labeled "4".
Stage 4:
- If the display is 1, press the button in the same position as you pressed in stage 1.
- If the display is 2, press the button in the first position.
- If the display is 3, press the button in the same position as you pressed in stage 2.
- If the display is 4, press the button in the same position as you pressed in stage 2.
Stage 5:
- If the display is 1, press the button with the same label you pressed in stage 1.
- If the display is 2, press the button with the same label you pressed in stage 2.
- If the display is 3, press the button with the same label you pressed in stage 4.
- If the display is 4, press the button with the same label you pressed in stage 3.
Input
There are multiple test cases. The first line of input is an integer T indicating the number of test cases. For each test case:
There are 5 lines. Each line contains 5 integers D, B1, B2, B3, B4 indicating the number on the display and the numbers on the buttons respectively. The i-th line correspond to the i-th stage.
Output
For each test case, output 5 lines. The i-th line contains two integers indicating the position and the label of the correct button for the i-th stage.
Sample Input
1
4 2 1 3 4
2 2 4 3 1
4 3 1 4 2
4 3 4 2 1
2 3 1 2 4
Sample Output
4 4
4 1
3 4
4 1
2 1
Hint
Keep talking with your teammates and nobody explodes!
题意:拆炸弹 5个阶段 根据显示的不同 按不同的键
题解:恶心模拟
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#define LL __int64
#define pi acos(-1.0)
#define mod 1
#define maxn 10000
using namespace std;
int t;
int d1,d2,d3,d4,d5;
int b1[];
int b2[];
int b3[];
int b4[];
int b5[];
int main()
{
while(scanf("%d",&t)!=EOF)
{
for(int i=;i<=t;i++)
{
int x1,y1;
int x2,y2;
int x3,y3;
int x4,y4;
int x5,y5;
scanf("%d %d %d %d %d",&d1,&b1[],&b1[],&b1[],&b1[]);
if(d1==||d1==)
{
x1=;
y1=b1[];
}
else
if(d1==)
{
x1=;
y1=b1[];
}
else
if(d1==)
{ x1=;
y1=b1[];
}
cout<<x1<<" "<<y1<<endl;
scanf("%d %d %d %d %d",&d2,&b2[],&b2[],&b2[],&b2[]);
if(d2==||d2==)
{
x2=x1;
y2=b2[x1];
}
else
if(d2==)
{
x2=;
y2=b2[];
}
else
if(d2==)
{ int k;
for(k=;k<=;k++)
if(b2[k]==)
break;
x2=k;
y2=;
}
cout<<x2<<" "<<y2<<endl;
scanf("%d %d %d %d %d",&d3,&b3[],&b3[],&b3[],&b3[]);
if(d3==)
{
int k;
for(k=;k<=;k++)
if(b3[k]==y2)
break;
x3=k;
y3=y2;
}
else
if(d3==)
{
int k;
for(k=;k<=;k++)
if(b3[k]==y1)
break;
x3=k;
y3=y1;
}
else
if(d3==)
{
x3=;
y3=b3[];
}
else
if(d3==)
{
int k;
for(k=;k<=;k++)
if(b3[k]==)
break;
x3=k;
y3=;
}
cout<<x3<<" "<<y3<<endl;
scanf("%d %d %d %d %d",&d4,&b4[],&b4[],&b4[],&b4[]);
if(d4==)
{
x4=x1;
y4=b4[x1];
}
else
if(d4==)
{
x4=;
y4=b4[];
}
else
if(d4==)
{ x4=x2;
y4=b4[x2];
}
else
if(d4==)
{
x4=x2;
y4=b4[x2];
}
cout<<x4<<" "<<y4<<endl;
scanf("%d %d %d %d %d",&d5,&b5[],&b5[],&b5[],&b5[]);
if(d5==)
{
int k;
for(k=;k<=;k++)
if(b5[k]==y1)
break;
x5=k;
y5=y1;
}
else
if(d5==)
{
int k;
for(k=;k<=;k++)
if(b5[k]==y2)
break;
x5=k;
y5=y2;
}
else
if(d5==)
{
int k;
for(k=;k<=;k++)
if(b5[k]==y4)
break;
x5=k;
y5=y4;
}
else
if(d5==)
{
int k;
for(k=;k<=;k++)
if(b5[k]==y3)
break;
x5=k;
y5=y3;
}
cout<<x5<<" "<<y5<<endl;
}
}
return ;
}
The 13th Zhejiang Provincial Collegiate Programming Contest - C的更多相关文章
- ZOJ 3946.Highway Project(The 13th Zhejiang Provincial Collegiate Programming Contest.K) SPFA
ZOJ Problem Set - 3946 Highway Project Time Limit: 2 Seconds Memory Limit: 65536 KB Edward, the ...
- The 13th Zhejiang Provincial Collegiate Programming Contest - D
The Lucky Week Time Limit: 2 Seconds Memory Limit: 65536 KB Edward, the headmaster of the Marja ...
- The 13th Zhejiang Provincial Collegiate Programming Contest - I
People Counting Time Limit: 2 Seconds Memory Limit: 65536 KB In a BG (dinner gathering) for ZJU ...
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Capture the Flag
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5503 The 12th Zhejiang Provincial ...
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Team Formation
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5494 The 12th Zhejiang Provincial ...
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Beauty of Array
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5496 The 12th Zhejiang Provincial ...
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Lunch Time
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5499 The 12th Zhejiang Provincial ...
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Convert QWERTY to Dvorak
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5502 The 12th Zhejiang Provincial ...
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest May Day Holiday
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5500 The 12th Zhejiang Provincial ...
随机推荐
- ant + jmeter 自动化接口测试环境部署
1.jdk下载安装 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html 2.jmeter下载 jmeter官 ...
- ABAP CDS ON HANA-(1)CDSビュー作成
Basic CDS View Creation Open HANA Studio. Goto ABAP perspective. Open the project, Navigate to the p ...
- 谈谈WPF中的CollectionView与CollectionViewSource (1)
原文:谈谈WPF中的CollectionView与CollectionViewSource (1) 谈谈WPF中的CollectionView与CollectionViewSource (1) ...
- 初步学习pg_control文件之十三
接前文,初步学习pg_control文件之十二 看这个: * backupStartPoint is the redo pointer of the backup start checkpoint, ...
- Python的入坑之路(1)
(故事背景:由于涉及到机密的原因,暂时不方便透露,待后期再写.) 国庆长假过完之后,回来上班第二天下午,Boss跟龙哥把我叫了出去,问我要不要转人工智能.一脸懵逼的我,带着一脸懵逼听Boss说人工智能 ...
- LeetCode高频题目(100)汇总-Java实现
LeetCode高频题目(100)汇总-Java实现 LeetCode高频题目(100)汇总-Java实现 目录 第01-50题 [Leetcode-easy-1] Two Sum [Le ...
- 【jQuery】 js 对象
[jQuery] js 对象 一. 创建对象的三种方式 <script> var v1 = new Object(); v1.name = "name1"; v1.a ...
- Java日志(二):log4j与XML配置文件
[Java日志(一):log4j与.properties配置文件]一文列举的几个案例以.properties文件作为log4j的配置文件,本文简单看一下log4j与XML配置文件 (1)XML配置文件 ...
- 「日常训练」 Mike and Fun (CFR305D2B)
题意(CodeForces 548B) 每次对01矩阵中的一位取反,问每次操作后,单列中最长连续1的长度. 分析 非常非常简单,但是我当时训练的时候WA了四次...无力吐槽了,人间 不值得.jpg 代 ...
- SpriteKit游戏开发适配iPad/iPhone6/7/8/Plus及iPhoneX的尺寸及安全区域
未适配前:Ball球超过屏幕的上下方 适配后:Ball球就在屏幕的可视范围内运动了 一.那么如何适配不同的iPhone.iPhoneX及iPad的屏幕尺寸呢? 我们开发一个App的时候, 通常希望 ...