A Duel of Two Proud Geniuses
Time limit0.5sMemory limit1024 MB
Given A in base u and B in base v, each with up to 3,000,000 digits of equal length, decide whether A is larger, B is larger, or they are equal.
- Level
Medium7 of 10
- Topics
- Math, String, Implementation
- Solved
- No attempts yet
Problem
Right now, the Erica campus of Hanyang University is in the middle of a craze over Erica-Card, a 1:1 card battle game. Each player places one card, and the player whose card shows the higher combat power (전투력) wins.
Ras and Auq are two geniuses with strong pride, and they want to settle their ranking through Erica-Card. However, Ras's combat power is written as a -ary integer, and Auq's combat power is written as a -ary integer, so they have trouble playing the game. The two numbers have the same length. In other words, each combat power has the same number of digits.
Look at the cards each player placed and determine who won.
Input
The first line contains two integers and , separated by a space.
The second line contains Ras's combat power written in base .
The third line contains Auq's combat power written in base .
and have no leading zeros, except when the value is .
Output
On the first line, print ras if Ras wins, auq if Auq wins, or rasauq if the combat powers are equal and neither player wins.