Here’s the link - MARBLES
I want to know why my code is giving a WA .Please help me in figuring this out. Here’s my code.
THANKS IN ADVANCE !!!
//JUST LIKE ANIMALS !!!!
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
bool ispalin(ll n){
ll i;
string s=to_string(n);
for(i=0;i<(s.length()/2);i++){
if(s[i]!=s[s.length()-1-i]){
return false;
}
}
return true;
}
int main(){
int t;cin>>t;
while(t--){
ll n,i;cin>>n;
if(n%99==0&&n%11==0)cout<<n+2<<endl;
else{
for(i=n+1;;i++){
if(ispalin(i)==true)
{
cout<<i<<endl;break;
}
}
}
}
return 0;
}