题解 | #反序相等#

反序相等

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

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务