Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

PALIN:Getting WA

$
0
0

i have submited the code

include<stdio.h>

define get getchar_unlocked()

//#define MAX 1000001 inline int fast_input(){ int input; char c=0; while(c<33)c=get; input=0; while(c>33){ input=input*10+c-'0'; c=get; } return input; }

inline long reverse(long n){ long sum=0; while(n!=0){ sum=(sum*10)+(n%10); n/=10; } return sum; }

inline long Is_palindrom(long i){ if(i==reverse(i)) return 1; else return 0; } int main() { int t; long k,i; // printf("\n\n"); t=fast_input(); //printf("\n\n"); while(t--){ k=fast_input(); for(i=k+1;;i++){ if(Is_palindrom(i)){ printf("%ld\n",i); break; } } // printf("\n\n"); } return 0; } but i am getting wrong answer,can any one help me. thanks in advance.


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>