URI Online Judge Solution 2454 Flipper Using Python Programming Language.
Flipper is a type of game where a metal ball falls through a maze of paths until it reaches the bottom of the maze. The amount of points the player earns depends on the path the ball takes. The player can control the path of the ball by changing the position of some small doors in the maze. Each small door can be in position 0, which means facing left, or in position 1, which means facing right. Consider the flipper in the figure below, which has two small doors. Door P is in position 1 and door R is in position 0. This way, the ball will fall down path B.
You must write a program that, given the positions of the doors P and R, on this flipper in the figure, tell which of the three paths, A, B or C, the ball will fall!
Input
The entrance consists of only one line containing two numbers P (0 or 1) and R (0 or 1), indicating the positions of the two flaps on the figure flipper.
Output
The output of your program should also be just one line, containing a capital letter that indicates the path where the ball will fall: 'A', 'B' or 'C'.
Entry Examples | Output Examples |
1 0 | B |
0 0 | Ç |
URI 2454 Solution in Python:
X,Y = map(int,input().split())
if X==0:
print("C")
elif X==1 and Y==0:
print("B")
else:
print("A")
Comments
Post a Comment