3 条题解

  • 0
    @ 2026-4-5 10:40:15

    import java.util.Scanner;

    public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //思路:双指针或者库方法
        String s=sc.next();
        StringBuilder s2=new StringBuilder(s).reverse();
        if(s.equals(s2.toString()))System.out.println("yes");
        else System.out.println("no");
    }   
    

    }

    • 0
      @ 2026-3-31 18:44:41

      #include <iostream #include <string using namespace std;

      int main() { string s; getline(cin, s); // 读取整行,包含空格

      int left = 0;
      int right = s.length() - 1;
      bool isPal = true;
      
      while (left < right) {
          if (s[left] != s[right]) {
              isPal = false;
              break;
          }
          left++;
          right--;
      }
      
      cout << (isPal ? "yes" : "no") << endl;
      return 0;
      

      }

      • 0
        @ 2026-3-12 11:38:13
        import sys
        input=lambda:sys.stdin.readline().strip()
        
        s=input()
        i,j=0,len(s)-1
        while(i<=j):
            if s[i] != s[j]:
                print("no")
                exit(0)
            i+=1
            j-=1
        print("yes")
        
        • 1

        信息

        ID
        319
        时间
        1000ms
        内存
        256MiB
        难度
        1
        标签
        递交数
        313
        已通过
        183
        上传者