1 条题解

  • 0
    @ 2026-2-10 16:08:35

    C :

    #include<stdio.h>
    int main()
    {
    	int a;
    	scanf("%d",&a);
    	if(a/10000==a%10 && (a%10000)/1000==(a%100)/10)
    	{
    		printf("Yes\n");
    	}
    	else
    	{
    		printf("No\n");
    	}
    	return 0;
    } 
    

    C++ :

    #include <iostream>
     using namespace std;
     int  main()
     {
         int n,a,b,c,d,e;
         cin>>n;
    	 a=n%10;
    	 b=n/10%10;
    	 c=n/100%10;
    	 d=n/1000%10;
    	 e=n/10000%10;
    	 if(a==e&&b==d)
    	 {
    	 	cout<<"Yes";
    	 }
    	 else
    	 {
    	 	cout<<"No";
    	 }
         return 0;
     } 
    

    Java :

    import java.util.Scanner;
    public class Main {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int a = sc.nextInt();
            if (a%10==a/10000 && a/10%10==a/1000%10){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }
    }
    

    Python :

    # coding=utf-8
    #!/usr/bin/python2
    import sys
    import re
    import math
    
    a = int(input())
    
    a1=a%10
    a=a/10
    a2=a%10
    a=a/10
    a3=a%10
    a=a/10
    a4=a%10
    a=a/10
    a5=a
    
    if a1==a5 and a2==a4:
        print "Yes"
    else:
        print "No"
     
    

    C# :

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Runtime.InteropServices;
    using System.Security.Cryptography;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace ConsoleApp2
    {
        internal class Program
        {
            static void Main()
            {
                string a = Console.ReadLine();
                string b = "";
    
                for (int i = 0; i <= a.Length - 1; i++)
                {
                    b+=a[a.Length - i - 1];
                    
    
                }
                if (a==b) { Console.WriteLine("Yes"); }
                else { Console.WriteLine("No"); }
                Console.ReadKey();
            }
        }
    }
    
    • 1

    信息

    ID
    30
    时间
    1000ms
    内存
    128MiB
    难度
    2
    标签
    递交数
    0
    已通过
    0
    上传者