__Unsigned__ @ 2025-01-10 20:52:57
样例对了,结果居然:
#include<iostream>
using namespace std;
const int MX=2147483647;
const int MN=-2147483648;
int r(int x){
int rev=0;
while(x!=0){
int pop=x%10;
x/=10;
if(rev>MX/10||(rev==MX/10&&pop>7)) return 0;
if(rev<MN/10||(rev==MN/10&&pop-8)) return 0;
rev=rev*10+pop;
}
return rev;
}
int j(int n,int m){
int ans=0;
while(m!=0){
int pop=m%n;
m/=n;
ans=ans*10+pop;
}
return r(ans);
}
int n,m,cnt;
int main(){
cin>>n>>m;
int ans=j(n,m);
while(ans!=r(ans)){
ans+=r(ans);
cnt++;
}
cout<<"STEP="<<cnt;
return 0;
}
求条玄关