1 条题解
-
0
练5.1 复读机
解题思路
把输入数作为字符串读入,再原样输出。
正确性说明
字符串读取保留数字的书写形式,输出值与输入相同。
易错点
不输出提示文字。
复杂度
本题规模固定,时间 O(1),额外空间 O(1)。
参考代码(C++11)
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); string n; cin >> n; cout << n << "\n"; return 0; }
- 1