B2039 整数大小比较

· · 题解

首先我们看到数据范围:

这说明了什么? 我们需要用 long long 来存储这两个数。 为什么呢? 因为 int 的范围是 $-2^{31}$ 到 $2^{31}-1$ 之间。 而 x 的大小有可能超过 int 的范围,所以我们要使用 long long 来存储。 剩下的就是按照题意进行模拟。 代码如下: ``` #include <iostream> #include <cstdio> #include <cstring> using namespace std; int main() { long long x, y; cin >> x >> y; if (x > y) { cout <<">"; } if (x == y) { cout <<"="; } if (x < y) { cout <<"<"; } return 0; } ```