Codeforces Beta Round #35 (Div. 2) / 35A Shell Game(模拟)
来源:互联网 发布:java 界面美化 编辑:程序博客网 时间:2024/05/08 03:32
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so that on the whole he makes exactly 3 shuffles. After that the spectators have exactly one attempt to guess in which cup they think the ball is and if the answer is correct they get a prize. Maybe you can try to find the ball too?
The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered from left to right and are renumbered after each shuffle from left to right again. In other words, the cup on the left always has index 1, the one in the middle — index 2 and the one on the right — index 3.
In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles.
11 22 12 1
2
12 13 11 3
2
water.
/*30ms,100KB*/#include<cstdio>int main(){int ball, n = 3;int a, b;freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);scanf("%d", &ball);while (n--){scanf("%d%d", &a, &b);if (a == ball)ball = b;else if (b == ball)ball = a;}printf("%d", ball);return 0;}
- Codeforces Beta Round #35 (Div. 2) / 35A Shell Game(模拟)
- Codeforces Round #401 (Div. 2) A. Shell Game(模拟)
- Codeforces Round #401 (Div. 2)A. Shell Game(水题~)
- Codeforces Round #401 (Div. 2) A.shell game
- Codeforces Round #401 (Div. 2) A. Shell Game
- Codeforces Beta Round #35 (Div. 2)
- Codeforces Beta Round #98 (Div. 2) / 137A Postcards and photos (模拟)
- Codeforces Beta Round #92 (Div. 2) / 124A The number of positions 【简单模拟】【水题】
- Codeforces Beta Round #96 (Div. 2) (模拟)
- Codeforces Beta Round #35 (Div. 2) C (BFS~水~)
- Codeforces Beta Round #35 (Div. 2), problem: (D) Animals DP
- 线段树Codeforces Beta Round #35 (Div. 2)
- Codeforces Round #297 (Div. 2) A(模拟)
- Codeforces Round #340 (Div. 2)(A) 模拟
- Codeforces Round #401(Div. 2)A. Shell Game【循环节规律】
- Codeforces Beta Round #95 (Div. 2) A B C E
- Codeforces Beta Round #18 (Div. 2 Only)——A
- Codeforces Beta Round #49 (Div. 2)—A
- 巧用“%”(不断更新中)
- ubuntu下解决codeblocks刚装好时终端不能粘贴的问题
- 定义一个继承层次的例子-Shape类Circle类的定义
- 排序算法--快速排序
- OpenCV读取摄像头显示原图像和RGB三通道直方图
- Codeforces Beta Round #35 (Div. 2) / 35A Shell Game(模拟)
- Find all arrangments
- openCV中图像的剪切
- opencv显示鼠标所在位置的rgb值
- hdu 2093
- delphi数据库:TADOConnection, TADOTable,TDataSource,TDBGrid,以及列名无效。
- ACM YTU 十进制与八进制的转换 (栈和队列) STL栈调用
- iTween大解构(一)之抛物线移动
- poj 1180 斜率优化dp