CF602A.Two Bases
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
After seeing the "ALL YOUR BASE ARE BELONG TO US" meme for the first time, numbers X and Y realised that they have different bases, which complicated their relations.
You're given a number X represented in base b__x and a number Y represented in base b__y. Compare those two numbers.
在第一次看到“All Your Base Are Belong To Us”这一网络迷因后,数字 X 和 Y 意识到它们使用了不同的进制,这使得它们之间的关系变得复杂。
你将得到一个以 b__x 进制表示的数 X,以及一个以 b__y 进制表示的数 Y。请比较这两个数的大小。
输入格式
The first line of the input contains two space-separated integers n and b__x (1 ≤ n ≤ 10, 2 ≤ b__x ≤ 40), where n is the number of digits in the b__x-based representation of X.
The second line contains n space-separated integers _x_1, _x_2, ..., x__n (0 ≤ x__i < b__x) — the digits of X. They are given in the order from the most significant digit to the least significant one.
The following two lines describe Y in the same way: the third line contains two space-separated integers m and b__y (1 ≤ m ≤ 10, 2 ≤ b__y ≤ 40, b__x ≠ b__y), where m is the number of digits in the b__y-based representation of Y, and the fourth line contains m space-separated integers _y_1, _y_2, ..., y__m (0 ≤ y__i < b__y) — the digits of Y.
There will be no leading zeroes. Both X and Y will be positive. All digits of both numbers are given in the standard decimal numeral system.
输入的第一行包含两个用空格分隔的整数 n 和 bx(1 ≤ n ≤ 10,2 ≤ bx ≤ 40),其中 n 表示 X 在 bx 进制下的位数。
第二行包含 n 个用空格分隔的整数 x1,x2,...,xn(0 ≤ xi < bx)——即 X 的各位数字,按从最高位到最低位的顺序给出。
接下来两行以相同方式描述 Y:第三行包含两个用空格分隔的整数 m 和 by(1 ≤ m ≤ 10,2 ≤ by ≤ 40,且 bx = by),其中 m 表示 Y 在 by 进制下的位数;第四行包含 m 个用空格分隔的整数 y1,y2,...,ym(0 ≤ yi < by)——即 Y 的各位数字。
输入中不会出现前导零。X 和 Y 均为正整数。两个数的所有数字均以标准十进制数字形式给出。
输出格式
Output a single character (quotes for clarity):
- '<' if X < Y
- '>' if X > Y
- '=' if X = Y
输出一个字符(引号仅用于清晰显示):
<若 X<Y>若 X>Y=若 X=Y
输入输出样例
输入#1
6 2 1 0 1 1 1 1 2 10 4 7
输出#1
=
输入#2
3 3 1 0 2 2 5 2 4
输出#2
<
输入#3
7 16 15 15 4 0 0 7 10 7 9 4 8 0 3 1 5 0
输出#3
>
说明/提示
In the first sample, X = 1011112 = 4710 = Y.
In the second sample, X = 1023 = 215 and Y = 245 = 1123, thus X < Y.
In the third sample,
and Y = 48031509. We may notice that X starts with much larger digits and b__x is much larger than b__y, so X is clearly larger than Y.
在第一个样例中,X=1011112=4710=Y。
在第二个样例中,X=1023=215 且 Y=245=1123,因此 X<Y。
在第三个样例中,
且 Y=48031509。我们可以注意到,X 的高位数字明显更大,且 bx 远大于 by,因此 X 明显大于 Y。
输入解题思路,AI测评打分。不知道怎么写?