3 条题解

  • 2
    @ 2024-10-29 10:46:34
    def fac(x):
        if len(x)==0 or len(x)==1:
            return "YES"
        if x[0]!=x[len(x)-1]:
            return "NO"
        return fac(x[1:len(x)-1])
    s=input()
    print(fac(s))
    
    • 1
      @ 2023-3-1 18:48:47

      C++

      Florance

      从中间往两边判断。

      int main(){
          string a; 
          int len; 
          cin >> a;
          len = a.length(); 
          for (int i = 0; i < len / 2; i++ ) { 
              if (a[i] != a[len - i - 1]) {
                  cout << "NO"; 
                  return 0;
              }
          }
          cout << "YES";
          return 0;
      }
      
      • 1
        @ 2023-2-17 19:14:08
        s = input()
        if s == s[::-1]:
            print("YES")
        else:
            print("NO")
        
        • 1

        信息

        ID
        812
        时间
        1000ms
        内存
        256MiB
        难度
        3
        标签
        递交数
        490
        已通过
        256
        上传者