2 条题解

  • 1
    @ 2025-12-21 14:34:42
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        string s;
        cin>>s;
        for(int i=0,j=s.size()-1;i<=s.size()/2;i++,j--)
            if(s[i]!=s[j]){
                cout<<"no"<<endl;
    			return 0; 
            }
        cout<<"yes"<<endl;
        return 0;
    }
    
    • -1
      @ 2025-12-18 21:14:36

      #include #include using namespace std;

      int main() { string s; getline(cin, s);

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

      }

      • 1

      信息

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