Files
python/TangDou/LanQiaoBei/LanQiao12ShengSai/BC1.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

20 lines
509 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
int main() {
string a;
//问题1:错误的使用了getline
//getline(cin,a);
//完全没有必要使用getline,因为题目没有可能包含空格,使用cin即可
//问题2:错误的使用for循环重复读取a,因为a是string,是一次性cin读取。
//问题3:a的界限是 a.size()-1 ,0 而不是a.size(),1
cin >> a;
for (int i = a.size() - 1; i >= 0; i--) printf("%c", a[i]);
return 0;
}