题意:给一个数n,让你找出长度为偶数,并且是第 n 个回文数。
析:你多写几个就知道了,其实就是 n,然后再加上n的逆序,不过n有点大,直接用string 好了。
代码如下:
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <set>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
using namespace std;
string s;
int main(){
cin >> s;
cout << s;
for(int i = s.size()-1; i >= 0; --i) cout << s[i];
cout << endl;
return 0;
}
浙公网安备 33010602011771号