Shell Game (类似找骰子游戏)
2014-03-24 12:05
776 查看
F- Shell Game p
[Submit] [GoBack]
[Status]DescriptionToday the «Z» city residents enjoy a shell game competition. Theresidents are gathered on the main square to watch thebreath-taking performance. The performer puts 3 non-transparentcups upside down in a row. Then he openly puts a small ball underone of the
cups and starts to shuffle the cups around very quicklyso that on the whole he makes exactly 3 shuffles. After that thespectators have exactly one attempt to guess in which cup theythink the ball is and if the answer is correct they get a prize.Maybe you can
try to find the ball too?InputThe first input line contains an integer from 1 to 3 — index ofthe cup which covers the ball before the shuffles. The followingthree lines describe the shuffles. Each description of a shufflecontains two distinct integers from 1 to 3 — indexes of the cupswhich
the performer shuffled this time. The cups are numbered fromleft to right and are renumbered after each shuffle from left toright again. In other words, the cup on the left always has index1, the one in the middle — index 2 and the one on the right — index3.OutputIn the first line output an integer from 1 to 3 — index of thecup which will have the ball after all the shuffles.Sample InputInput
Time Limit: 2000MS | Memory Limit: 65536K | 64bit IO Format: %I64d& %I64u |
[Status]DescriptionToday the «Z» city residents enjoy a shell game competition. Theresidents are gathered on the main square to watch thebreath-taking performance. The performer puts 3 non-transparentcups upside down in a row. Then he openly puts a small ball underone of the
cups and starts to shuffle the cups around very quicklyso that on the whole he makes exactly 3 shuffles. After that thespectators have exactly one attempt to guess in which cup theythink the ball is and if the answer is correct they get a prize.Maybe you can
try to find the ball too?InputThe first input line contains an integer from 1 to 3 — index ofthe cup which covers the ball before the shuffles. The followingthree lines describe the shuffles. Each description of a shufflecontains two distinct integers from 1 to 3 — indexes of the cupswhich
the performer shuffled this time. The cups are numbered fromleft to right and are renumbered after each shuffle from left toright again. In other words, the cup on the left always has index1, the one in the middle — index 2 and the one on the right — index3.OutputIn the first line output an integer from 1 to 3 — index of thecup which will have the ball after all the shuffles.Sample InputInput
1 1 2 2 1 2 1Output
2Input
1 2 1 3 1 1 3Output
2
#include<iostream>
using namespace std;
int main()
{
int n,a1,b1,a2,b2,a3,b3;
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);while(cin>>n)
{cin>>a1>>b1;
cin>>a2>>b2;
cin>>a3>>b3;
if(a1==n||b1==n)
{
if(a1==n) n=b1;
else n=a1;
}
if(a2==n||b2==n)
{
if(a2==n) n=b2;
else n=a2;
}if(a3==n||b3==n)
{
if(a3==n) n=b3;
else n=a3;
}
cout<<n<<endl;
}
return 0;}
相关文章推荐
- Game 迷城的国度 Next(类似暗黑的游戏)
- Game 迷城的国度 Next(类似暗黑的游戏)
- C#开发WPF/Silverlight动画及游戏系列教程(Game Tutorial):(四十六)飞行模式 – 自由VS天空
- love2d游戏2--1942game(二)
- (译)如何制作一个类似tiny wings的游戏:第二部分(完)
- [JSOI2009]游戏Game
- C#开发WPF/Silverlight动画及游戏系列教程(Game Tutorial):(三十七)地图自适应区域加载
- Unity3D开发类似保龄球游戏
- Godot教程中文版-一个简单的2D游戏(Simple 2D Game,Pong!)
- blender game document 游戏引擎开发的建议
- python语言学习笔记(三)-----模拟投掷三个骰子,对游戏结果进行统计
- 带你开发类似Pokemon Go的AR游戏(1)
- Pokergameteacher-游戏
- Unity 开发游戏Game分辨率设置
- 本文将引导你使用XNA Game Studio Express一步一步地创建一个简单的游戏
- poj 3752 字母旋转游戏 类似搜索
- P3041 [USACO12JAN]视频游戏的连击Video Game Combos
- TypeGame- Vim中的打字游戏
- 『遥かに仰ぎ、丽しの』游戏初回版特典原声集 GAME SP OST(下载、中日双语歌词)