50分
查看原帖
50分
749028
QAQ5楼主2024/12/30 11:22
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        char[] outcomes;//胜负局
        {
            ArrayList<String> lines = new ArrayList<>();
            {
                Scanner scanner = new Scanner(System.in);
                String line;
                do {
                    line = scanner.nextLine();
                    if (line.contains("E")) {
                        line = line.substring(0, line.indexOf("E"));
                        lines.add(line);
                        break;
                    }
                    lines.add(line);
                } while (true);
            }
            int charCount = 0;
            for (String line : lines) {
                charCount += line.length();
            }
            outcomes = new char[charCount];
            int i = 0;
            for (String line : lines) {
                char[] chars = line.toCharArray();
                for (char aChar : chars) {
                    outcomes[i++] = aChar;
                }
            }
        }
        final int endSystem = 21;
        for (int system = 11; ; system = endSystem) {
            int i = 0;
            exit:
            while (true) {
                int W = 0, L = 0;
                for (int count = 0; count < system; count++) {
                    if (i < outcomes.length) {
                        char get = outcomes[i++];
                        if (get == 'W') W++;
                        else if (get == 'L') L++;
                    } else {
                        System.out.println(W + ":" + L);
                        break exit;
                    }
                }
                System.out.println(W + ":" + L);
            }
            if (system == endSystem) break;
            else System.out.println();
        }
    }
}

2024/12/30 11:22
加载中...