let's start Code

1225 - Palindromic Numbers (II)

1225 - Palindromic Numbers (II)

Solution:

 


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll Max = 100005;

void palindrome(ll n, int cs)
{
  ll test = n;
  ll ans = 0;
  while(n)
  {
     ans = ans*10 + n%10;
    n /= 10;
  }
  cout << "Case "<<cs<<": ";
  if(test == ans)cout << "Yes\n";
  else cout << "No\n";
}

int main()
{
    ///*
  #ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
  #endif
    //*/
    int t;
    cin >> t;
    for(int cs = 1; cs <= t; cs++){
      ll n;
    cin >> n;
    palindrome(n, cs);
    }

  //double end_time = clock();
  //printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);

    return 0;
}
Share:

No comments:

Post a Comment

About

let's start CODE

Popular Posts