关于c++:PapaMelon-2-AB-注意整形溢出

2次阅读

共计 165 个字符,预计需要花费 1 分钟才能阅读完成。

题目链接

  • A+B

题解

  • 这道题次要是用于相熟 OJ 的输入输出
  • 输出的两个整数范畴都在 int32 范畴内,但相加后可不肯定了 :),留神溢出的问题
#include <iostream>
using namespace std;

int main() {
    int a, b;
    while (cin >> a >> b) {cout << 0LL + a + b << endl;}
    return 0;
}
正文完
 0