'commit'
This commit is contained in:
26
TangDou/LuoGuBook/P5461_1.cpp
Normal file
26
TangDou/LuoGuBook/P5461_1.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
//判断回文数
|
||||
bool isHWS(int num) {
|
||||
int t = num, ans = 0;
|
||||
while (t) {
|
||||
ans = ans * 10 + t % 10;
|
||||
t /= 10;
|
||||
}
|
||||
return ans == num;
|
||||
}
|
||||
|
||||
int main() {
|
||||
vector<int> nums;
|
||||
int a = 123454321;
|
||||
while (a) {
|
||||
nums.push_back(a % 10); //5 4 3 2 1
|
||||
a /= 10;
|
||||
}
|
||||
int res = 0;
|
||||
for (int i = 0; i < nums.size(); i++)
|
||||
res = res * 10 + nums[i];
|
||||
cout << res << endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user