CF35A.Shell Game
入门
通过率:0%
时间限制:2.00s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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?
今天,「Z」城的居民正在举行一场套杯游戏比赛。居民们聚集在主广场上,观看这场令人屏息的表演。表演者将 3 个不透明的杯子倒扣成一排。接着,他当着观众的面将一个小球放在其中一个杯子下面,然后以极快的速度交换杯子的位置,总共恰好进行 3 次交换。之后,观众仅有一次机会猜测小球位于哪个杯子下面;若猜中,即可获得奖品。你是否也想试着找出小球的位置呢?
输入格式
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.
第一行输入包含一个从 1 到 3 的整数——表示初始时覆盖小球的杯子的编号。接下来的三行描述了三次交换操作。每次交换操作的描述包含两个互异的、取值范围为 1 到 3 的整数——表示该次操作中表演者所交换的两个杯子的编号。杯子从左到右依次编号,且每次交换后均重新从左到右再次编号。换言之,最左侧的杯子编号始终为 1,中间的杯子编号为 2,最右侧的杯子编号为 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.
第一行输出一个 1 到 3 之间的整数——所有交换操作结束后,小球所在的杯子的编号。
输入输出样例
输入#1
1 1 2 2 1 2 1
输出#1
2
输入#2
1 2 1 3 1 1 3
输出#2
2
输入解题思路,AI测评打分。不知道怎么写?