Tuesday, July 28, 2015

1225 - Palindromic Numbers (II)

#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    long long  T,n,a,num,i,c=1;
    scanf("%lld",&T);
    while(T--)
    {
        scanf("%lld",&n);
        num=0;
        i=0;
        a=n;
        while(a>9)
        {
            num = num*10+a%10;
            a /= 10;
        }
        num = num*10+a;
        if(num==n)
            printf("Case %lld: Yes\n",c++);
        else
            printf("Case %lld: No\n",c++);
    }
    return 0;
}

No comments:

Post a Comment

Triathlon

Triathlon - CodeChef # include < bits/stdc++.h > using namespace std ; # define fi first # define se second # define mp ...