Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
102512 王子毅 15反转数字 C++ Accepted 0 MS 272 KB 306 2024-12-21 19:01:31

Tests(10/10):


Code:

#include <iostream> using namespace std; int main() { int n; cin >> n; int rev_n = 0; int abs_n = abs(n); while (abs_n!= 0) { rev_n = rev_n * 10 + abs_n % 10; abs_n /= 10; } if (n < 0) { rev_n = -rev_n; } cout << rev_n << endl; }