-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA.cpp
46 lines (44 loc) · 970 Bytes
/
A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <bits/stdc++.h>
using namespace std;
#define cerr cerr << "DEBUG "
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int tc;
cin >> tc;
while (tc--) {
long long x1, x2, p1, p2;
cin >> x1 >> p1 >> x2 >> p2;
string s1, s2;
while (x1 > 0) {
s1 += (char) (x1 % 10 + '0');
x1 /= 10;
}
while (x2 > 0) {
s2 += (char) (x2 % 10 + '0');
x2 /= 10;
}
reverse(s1.begin(), s1.end());
reverse(s2.begin(), s2.end());
if (s1.size() + p1 != s2.size() + p2) {
cout << (s1.size() + p1 < s2.size() + p2 ? "<\n" : ">\n");
continue;
}
if (s1.size() < s2.size()) {
int c = s2.size() - s1.size();
for (int i = 0; i < min<int>(p1, c); ++i) {
s1 += '0';
}
} else {
int c = s1.size() - s2.size();
for (int i = 0; i < min<int>(p2, c); ++i) {
s2 += '0';
}
}
if (s1 == s2) {
cout << "=\n";
} else {
cout << (s1 < s2 ? "<\n" : ">\n");
}
}
}