3 条题解
-
0
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
#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;}
- 1
信息
- ID
- 319
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 1
- 标签
- 递交数
- 313
- 已通过
- 183
- 上传者