Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
41658 YOYOLEE-李昕颖 回文数 C++ 解答错误 1 MS 260 KB 644 2024-02-22 21:00:23

Tests(0/4):


#include<bits/stdc++.h> using namespace std; int main() { int n,c=-1; bool flag=true; char m[100],dm[100],ds[1000],s[1000]; cin>>n; gets(m); for(int i=1; ;i++){ for(int j=c;j>=0;j--){ dm[c-j]=m[j]; } for(int j=c;j>=0;j--){ s[j]=dm[j]+m[j]; if(s[j]>=n){ s[j]-=n; s[j-1]++; } } for(int j=c+1;j>=0;j--){ if(j==0&&s[j]==0){ break; } ds[c-j]=s[j]; } for(int j=c;j>=0;j--){ if(dm[j]!=s[j]) flag=false; } if(flag==false) continue; else if(flag==true&&i>=30){ cout<<"Impossible!"; return 0; } else{ cout<<"STEP="<<i; return 0; } } }


测评信息: