题解 | #反序相等#
反序相等
https://www.nowcoder.com/practice/092e7068881549bd8985c379208ef3c2
#include <bits/stdc++.h>
using namespace std;
string f(int i){
i*=9;
string s = to_string(i);
reverse(s.begin(),s.end());
return s;
}
int main() {
for(int i = 1000;i<=9999;i++){
if(to_string(i) == f(i))
cout<<i<<endl;
}
}
// 64 位输出请用 printf("%lld")
qd


查看5道真题和解析