两道水题,用来熟悉 HOJ 的提交系统。1002 需要考虑溢出。直接贴出代码:
#include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { cout << (a + b) << endl; } return 0; }
#include <iostream> using namespace std; int main() { long long a, b, c; while (cin >> a >> b >> c) { cout << (a + b + c) << endl; } return 0; }
时间: 2024-12-29 23:55:50