9 solutions

  • 2
    @ 2023-10-28 20:03:49
    #include<iostream>
    #include<string>
    using namespace std;
    int main()
    {
     string a;
     cin>>a;//输入
     for(int i=0;i<a.length();i++)
     {
      if(a[i]!=a[a.length()-i-1])//与对应的是否不一样
      {
       cout<<"no";//不一样就no
       return 0;
      }
     }
     cout<<"yes";//反之,都一样就yes
     return 0;//完结散花!
    }
    
    • 1
      @ 2024-10-25 21:00:02
      #include<bits/stdc++.h>
      using namespace std;
      string n;
      int main(){
      	getline(cin,n);
      	for(int i=0,j=(n.length()-1);i<=(n.length()/2+1),j>=(n.length()/2+1);i++,j--){   //双指针分别指向头和尾,头加尾减
      		if(n[i]!=n[j]){    //判断
      			cout<<"no";
      			return 0;
      		}
      	}
      	cout<<"yes";
      	return 0;
      }
      
      • 1
        @ 2023-10-5 10:58:49
        #include<bits/stdc++.h>
        using namespace std;
        string n;
        bool f=true;
        int main(){
        	getline(cin,n);
        	long x;
        	for(x=1;n[x];x++);
        	for(int i=0;i<x/2;i++){
        		if(n[i]!=n[x-i-1]){
        			f=false;
        		}
        	}
        	if(f) cout<<"yes";
        	else cout<<"no";
        	return 0;
        }
        

        争做题解第一人

        • 0
          @ 2024-10-10 19:10:05
          #include<bits/stdc++.h>
          using namespace std;
          char a[100000010];
          bool x = true;
          int main()
          {
          	int num = 0, n = 1;
          	while(cin >> a[n])
          	{
          		num++;
          		n++;
          	}
          	for(int i = 1; i <= n/2; i++)
          	{
          		
          		if(a[i] != a[n-i])
          		{
          			x = false;
          			break;
          		}
          
          	}
          	
          	if(x == true)
          	{
          		cout << "yes";
          	}
          	else
          	{
          		cout << "no";
          	}
          	
          	return 0;
          }
          
          
          • 0
            @ 2023-12-23 18:59:06
            #include <bits/stdc++.h>
            using namespace std;
            int main(){
            	char st[101];
            	cin>>st;
            	int i,j;
            	for(i=0,j=strlen(st)-1;i<=j;j--,i++) if(st[i]!=st[j]) break;
            	if(j<i) cout<<"yes";
            	else cout<<"no";
            	return 0;
            }
            
            • 0
              @ 2023-12-9 0:47:00

              #include<bits/stdc++.h> using namespace std; int main(){ char a[10000]; gets(a); int s=strlen(a); for(int i=0;i<s;i++){ if(a[i]!=a[s-i-1]){ cout<<"no"; return 0; } } cout<<"yes"; }

              • 0
                @ 2023-10-15 11:00:25
                #include <bits/stdc++.h>
                using namespace std;
                
                int main(){
                	char st[101];
                	cin>>st;
                	int i,j;
                	for(i=0,j=strlen(st)-1;i<=j;j--,i++){
                		if(st[i]!=st[j]) break;
                	}
                	                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                	if(j<i) cout<<"yes";
                	else cout<<"no";
                	return 0;
                } 
                
                
                • 0
                  @ 2023-10-9 13:43:15
                  #include <bits/stdc++.h>
                  using namespace std;
                  string s;
                  int main(int argc, char **argv){
                  	getline(cin,s);
                  	int len = s.length();bool f = 1;
                  	for (int i = 0;i <= len / 2 + 1;i++){
                  		if (s[i] != s[len - i - 1]){
                  			f = 0;
                  		}
                  	}
                  	if (f){
                  		cout << "yes";
                  	}else{
                  		cout << "no";
                  	}
                  	return 0;
                  }
                  
                  • -1
                    @ 2023-10-5 11:01:58

                    #include<bits/stdc++.h> using namespace std; int main(){ string s; getline(cin,s); int siz=int(s.size())-1; for(int i=0;i<siz;i++){ if(s[i]!=s[siz-i]){ cout<<"no"; break; } else if(i>=siz/2){ cout<<"yes"; break; } } return 0; }

                    • 1

                    Information

                    ID
                    632
                    Time
                    1000ms
                    Memory
                    256MiB
                    Difficulty
                    4
                    Tags
                    # Submissions
                    88
                    Accepted
                    42
                    Uploaded By