15 条题解

  • 10
    @ 2022-10-3 15:43:51
    #include<stdio.h>
    int main(){
     	int i,tmp,input,sum=0;
    	scanf("%d",&input);
    	for(i=input;i;i/=10){
    		tmp=i%10;
    		sum=sum*10+tmp;		//计算出倒数 
    	}
        sum==input?printf("yes"):printf("no");
        return 0;
    }
    
    
    • 2
      @ 2023-10-24 17:50:23
      #include<stdio.h>
      #include <string.h>
      int main()
      {
      int lang;
      char str[1000],str1[1000];
      gets(str);
      lang=strlen(str);
      for (int i = 0; i < lang; i++)
      {
      str1[i] = str[lang - 1 - i];
      }
      //str[lang] = '\0';
      str1[lang] = '\0';
      /*printf("%s\n", str);
      printf("%s", str1);
      printf("%d", strcmp(str, str1));*/
      if (strcmp(str, str1)==0)
      {
      printf("yes");
      }
      else
      {
      printf("no");
      }
      return 0;
      }
      
      
      • 1
        @ 2025-8-29 13:41:27
        import java.util.Scanner;
        
        public class Main {
            public static void main(String[] args) {
                Scanner sc = new Scanner(System.in);
                String n = sc.next();
                int first = 0, end = n.length() - 1;
                boolean isPalindrome = true;
                
                while (first < end) {
                    if (n.charAt(first) == n.charAt(end)) {
                        first++;
                        end--;
                    } else {
                        isPalindrome = false;
                        break;
                    }
                }
                
                if (isPalindrome) {
                    System.out.println("yes");
                } else {
                    System.out.println("no");
                }
            }
        }
        

        双指针的算法思想,可以去了解了解,我这里是java写的

        • 1
          @ 2024-4-24 22:12:41
          #include <stdio.h>
          #include <stdlib.h>
          #include "math.h"
          int main()
          {
              int nb(int a);
              int power(int a, int b);
              int a,n,i;
              scanf("%d",&a);
              n=nb(a);
              i=n;
              int num[n],b=a;
              while (i>0)
              {
                  num[i]=(int)(b/(int)pow(10,i-1));
                  b=b-num[i]*(int)pow(10,i-1);
                  i--;
              }
          
              i=1;
              int c;
              while (i<=n)
              {
                  c+=num[i]*pow(10,n-i+1)/10;
                  i++;
              }
              if(c==a)printf("yes");
              else printf("no");
          
              system("pause");
              return 0;
          }
          
          int nb(int a)
          {
              int nb=0,ns=1;
              while(a/ns!=0)
              {
                  nb++;
                  ns=10*ns;
              }
              return nb;
          }//
          
          • 1
            @ 2023-7-28 2:07:29

            懒得算.png

            #include<iostream>
            using namespace std;
            int main() {
                string s;
                cin >> s;
                bool flag = 1;
                int longofNum = s.size();
                for (int i = 0;i < longofNum - 1;i++) {
                    if (s[i] != s[longofNum - 1 - i]) flag = 0;
                }
                if (flag) cout << "yes";
                else cout << "no";
            }
            
            • 1
              @ 2022-10-3 23:20:33
              #include <iostream>
              #include <string.h>
              #include <stdio.h>
              #include <algorithm>
              using namespace std;
              int main()
              { 
               	int hws,b,sum=0;
               	cin>>hws;
               	for(int a=hws;a>0;a/=10)
               	{
               		b=a%10;//一次是个,2次十位,等等
              		sum=sum*10+b; 
              	 }
              	 if(sum==hws)
              	 {
              	 	cout<<"yes";
              	 
              	 }
              	 	else
              	 	cout<<"no";
              		return 0;
              }
              yujie好厉害
              
              • 0
                @ 2024-8-20 15:39:05

                #include <stdio.h> int main() { int x,a,b=0,c; scanf("%d",&x); a=x; while(x!=0) { c=x%10; b=b*10+c; x/=10; } if(a==b) { printf("yes\n"); } else { printf("no\n"); } return 0; }

                • 0
                  @ 2024-7-23 23:03:08
                  a=input()
                  if a[::-1]==a:
                      print("yes")
                  else:
                      print("no")
                  
                  • 0
                    @ 2023-12-26 20:56:10

                    #include<stdio.h> int main() { int i,n,j=0; int a[100]; int k=0; scanf("%d",&n); while(n>0) { i=n%10; a[j]=i; n=n/10; j=j+1; } for(i=0;i<j/2;i++) { if(a[i]!=a[j-1-i]) { k++; } } if(k==0) { printf("yes"); } else { printf("no"); } return 0; }

                    • 0
                      @ 2023-10-21 7:26:07

                      #include<stdio.h> int isPalindrome(int x){ if(x<0){ return 0; } int div=1; while(x / div>=10){ div*=10; } while(x>0){ int left = x / div; int right = x % 10; if(left != right){ return 0; } x = (x % div)/10; div /= 100; } return 1; }

                      int main() { int x; scanf("%d",&x); if(isPalindrome(x)){ printf("yes"); }else{ printf("no"); }

                      return 0;
                      

                      }

                      • 0
                        @ 2023-9-30 16:20:13

                        #include<stdio.h> int main(){ int X; int Y=0; scanf("%d",&X); for(int i=X;i>0;i=i/10){ Y=i%10+Y*10; } if(Y==X) printf("yes");

                        else
                            printf("no");
                        
                        return 0;
                        

                        }

                        • 0
                          @ 2022-10-26 0:10:29

                          #include<iostream> using namespace std;

                          int main() { int n,b; cin>>n; int a=n; while(n>0) { b=10*b+n%10; n/=10; } if(a==b) { cout<<"yes"<<endl; } else { cout<<"no"<<endl; } return 0; }

                          • 0
                            @ 2022-10-6 14:15:05

                            #include<stdio.h> int main(){ int n,a=0; scanf("%d",&n); for(int i=n;i>0;i/=10) { a=a*10+i%10;} if(n==a){printf("yes");} else {printf("no");} return 0; }

                            • 0
                              @ 2022-9-26 17:17:26

                              #include<stdio.h> bool hws(long int x) {

                              long int s, y=0;
                              s=x;
                              while(s>0)
                              {
                              	y=y*10+s%10;
                              	s=s/10;
                              	
                              }
                              if(y==x)
                              return true;
                              else
                              return false;
                              

                              } int main(){ long int n; scanf("%ld",&n); bool flag = hws(n); if(flag==0){ printf("no");}else{ printf("yes");} return 0;

                              }

                              • -5
                                @ 2022-10-21 20:00:20

                                #include<stdio.h> int main() { int j,n=0,X; scanf("%d",&X); j=X; while(j) { n=n*10+j%10; j/=10; } if(n==X) printf("yes"); else printf("no");

                                }

                                • 1

                                信息

                                ID
                                32
                                时间
                                1000ms
                                内存
                                128MiB
                                难度
                                6
                                标签
                                递交数
                                4451
                                已通过
                                1459
                                上传者