2 条题解

  • 1
    @ 2025-3-15 15:53:06
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	string s;
    	cin>>s;
    	int len = s.size();
    	if(len<4)
    	{
    		cout<<s;
    		return 0;
    		}	
    	string s1 = s.substr(len-2);
    	string s2 = s.substr(len-2);
    	string t= s;
    	if(s1=="ly"||s1=="er")
    	{
    		t = s.substr(0,len-2);
    	}
    	 else if (s2 =="ing")
    	 {
    	 	t=s.substr(0,len-3);
    	 }
    	 
    	cout<<t;
    	
    	return 0;
    }
    • 0
      @ 2025-2-20 16:23:06
      using namespace std;
      int main()
      {
      	string s;
      	cin>>s;
      	int len = s.size();
      	if(len<4)
      	{
      		cout<<s;
      		return 0;
      		}	
      	string s1 = s.substr(len-2);
      	string s2 = s.substr(len-2);
      	string t= s;
      	if(s1=="ly"||s1=="er")
      	{
      		t = s.substr(0,len-2);
      	}
      	 else if (s2 =="ing")
      	 {
      	 	t=s.substr(0,len-3);
      	 }
      	 
      	cout<<t;
      	
      	return 0;
      }
      //https://www.bilibili.com/video/BV1U84y1w7wn?spm_id_from=333.788.player.switch&vd_source=42c02d8f2977de812d87f471f8153d89
      
      
      • 1

      信息

      ID
      1306
      时间
      1000ms
      内存
      128MiB
      难度
      6
      标签
      (无)
      递交数
      65
      已通过
      22
      上传者