1 条题解

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

    C++ :

    #include <iostream>
    #include <cstdio>
    #include <cmath>
    using namespace std;
    
    void f(string s, int score) {
    	int w = 0, l = 0;
    	for (int i = 0; i < s.size(); i++){
    		if (s[i] == 'E') break;
    		
    		if (s[i] == 'W') w ++;
    		if (s[i] == 'L') l ++;
    		
    		if ((w>=score || l>=score) && abs(w-l)>=2) {
    			printf("%d:%d\n", w, l);
    			w = l = 0;
    		}		
    	}
    	printf("%d:%d\n\n", w, l);
    }
    
    int main() {
    	string s, str;
    	while (cin >> str) {
    		s += str;
    	}
    	
    	f(s, 11);
    	f(s, 21);
    	
    	return 0;
    }
    
    • 1

    信息

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