1 solutions
-
0
C :
#include<stdio.h> int main() { int m,n,t,a,b,c,d; scanf("%d",&m); n=m/100000; t=m%10; a=m/10000%10; b=m/10%10; c=m/1000%10; d=m/100%10; if(n==t&&a==b&&c==d) printf("Y"); else printf("N"); return 0; }
C++ :
#include <bits/stdc++.h> using namespace std; int main(){ int n,g,s,b,q,w,sw; cin>>n; sw = n / 100000; w = n / 10000 % 10; q = n / 1000 % 10; b = n / 100 % 10; s = n / 10 % 10; g = n % 10; if(sw == g && w == s && q == b){ cout<<"Y"; }else{ cout<<"N"; } }
Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int g = n % 10; int s = n / 10 % 10; int b = n / 100 % 10; int q = n / 1000 % 10; int w = n / 10000 % 10; int sw = n / 100000; if(g==sw && s==w && b==q){ System.out.println("Y"); }else{ System.out.println("N"); } } }
Python :
x = int(input()) a = x//100000 b = x//10000%10 c = x//1000%10 y = 100000*a + 10000*b + 1000*c + 100*c + 10*b + a if y == x: print('Y') else: print('N')
- 1
Information
- ID
- 10197
- Time
- 1000ms
- Memory
- 64MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By