1 条题解

  • 0
    @ 2025-4-7 21:38:07

    C++ :

    #include<iostream>
    #include<cstdio>
    #include<cstdlib>
    #include<cstring>
    #include<string>
    #include<cmath>
    #include<algorithm>
    #include<iomanip>
    #include<cctype>
    using namespace std;
    string s="";
    char c;
    int a=0,b=0;
    void print(){
    	printf("%d:%d\n",a,b);
    	a=0; b=0;
    }
    int main(){
    	int i;
    	//freopen("table.in","r",stdin);
    	//freopen("table.out","w",stdout);
    	while(1) {
    		scanf("%c",&c);
    		if(c=='E') break;
    		s+=c;
    	}
    	for(i=0;i<s.size();i++){
    		if(s[i]=='W') a++;
    		if(s[i]=='L') b++;
    		if((a>10||b>10)&&abs(a-b)>1) print();
    	}
    	 print();
    	cout<<endl;
    	for(i=0;i<s.size();i++){
    		if(s[i]=='W') a++;
    		if(s[i]=='L') b++;
    		if((a>20||b>20)&&abs(a-b)>1) print();
    	}
    	 print();
    	return 0;
    } 
    
    • 1

    信息

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