3 solutions

  • 1
    @ 2025-1-21 10:50:10
    #include<bits/stdc++.h>
    using namespace std;
    const int N=110;
    char s[N];
    int main()
    {
    	cin.getline(s,N);
    	int n=strlen(s);
    	for(int i=0,j=n-1;i<j;i++,j--) //首尾往中靠 
    	{
    		if(s[i]!=s[j]) //不相同 
    		{
    			cout<<"no";
    			return 0;
    		}
    	}
    	cout<<"yes";
    return 0;
    }
    
    
    • 0
      @ 2024-8-23 11:51:21
      #include<bits/stdc++.h>
      using namespace std;
      const int N=110;
      char s[N];
      int main()
      {
      	cin.getline(s,N);
      	int n=strlen(s);
      	for(int i=0,j=n-1;i<j;i++,j--) //首尾往中靠 
      	{
      		if(s[i]!=s[j]) //不相同 
      		{
      			cout<<"no";
      			return 0;
      		}
      	}
      	cout<<"yes";
      return 0;
      }
      
      • -1
        @ 2024-9-8 10:24:27

        #include<bits/stdc++.h> using namespace std; const int N=1000; char s[N]; int main() { cin.getline(s,N); int n=strlen(s); for(int i=0,j=n-1;i<j;i++,j--) { if(s[i]!=s[j]) { cout<<"no"; return 0; } } cout<<"yes"; return 0; }

        • 1

        Information

        ID
        921
        Time
        1000ms
        Memory
        256MiB
        Difficulty
        1
        Tags
        (None)
        # Submissions
        60
        Accepted
        27
        Uploaded By