#include<iostream>
#include<sstream>
#include<string>
using namespace std;
int main(void)
{
long int x,p=0;
cin>>x;
for(int i=0;i<x;i++){
long int n;
long int m;
cin>>m;
m++;
string a;
ostringstream ss;
ss << m;
a = ss.str();
while(true){
int licz=0,temp=0;
bool t=true;
for(int k=a.size(),j=-1;k>=0;k--,j++){
if(a[k]==' '){
k-=1;
temp--;
}
if(a[j]==' '){
j+=1;
temp--;
}
if(a[k]==a[j] || a[k]=='\0')licz+=1;
else t = false;
if(k==j)break;
}
if(t==true){
istringstream iss(a);
iss >> n;
cout<<n;
break;
}
else {
istringstream iss(a);
iss >> n;
n++;
ostringstream ss;
ss << n;
a = ss.str();
}
}//while
}//for
//getchar();
//return 0;
}
...why wrong answer ?
created
last reply
- 1
reply
- 99
views
- 2
users