c++基础_特殊回文数

#include <iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i=10000;i<1000000;i++){
        int temp=i;
        int total=0,m=0;
        while(temp){
            total=total+(temp%10);
            m=temp%10+m*10;
            temp/=10;
        }
        if(m==i&&n==total){
            cout<<i<<endl;
        }
    }
}

 

posted on 2018-03-26 22:21  我吃你大西瓜  阅读(249)  评论(0编辑  收藏  举报

导航