| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 65767 | zyqll | A+B 输入输出练习I | C++ | Accepted | 5 MS | 276 KB | 763 | 2024-02-09 19:27:47 |
#include <iostream> #include <string> int main() { std::string line; while (getline(std::cin, line)) { std::string a, b; size_t pos = line.find(' '); if (pos != std::string::npos) { a = line.substr(0, pos); b = line.substr(pos + 1); } else { std::cerr << "Invalid input format" << std::endl; continue; } int aValue, bValue; try { aValue = std::stoi(a); bValue = std::stoi(b); } catch (const std::invalid_argument&) { std::cerr << "Invalid integer input" << std::endl; continue; } std::cout << aValue + bValue << std::endl; } return 0; }