QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#217534#5596. I Could Have WonViktor#WA 1ms3488kbC++14985b2023-10-16 22:58:312023-10-16 22:58:32

Judging History

你现在查看的是最新测评结果

  • [2023-10-16 22:58:32]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3488kb
  • [2023-10-16 22:58:31]
  • 提交

answer

#include <iostream>

using namespace std;

typedef basic_string<char> string;
int rounds[2000];

int main() {
    string input;
    cin >> input;       //Input
    int input_length = input.length(); //StringLength
    int ACounts = 0, BCounts = 0, AWins = 0, BWins = 0, pos = 0;

    for (int k = 1; k < input_length; k++) {
        for (int pos = 0; pos < input_length; pos++) {
            if (input[pos] == 'A') { ACounts++; }
            else { BCounts++; }

            if (ACounts == k) {
                AWins++;
                ACounts = BCounts = 0;
            }
            else if (BCounts == k) {
                BWins++;
                BCounts = ACounts = 0;
            }
        }
        if (AWins > BWins) { rounds[pos++] = k; }
        ACounts = BCounts = AWins = BWins = 0;
    }
    
    cout << pos << endl;
    for (int i = 0; i < pos; i++) {
        cout << rounds[i] << " ";
        if (i == pos-1) {
            cout << endl;
        }
    }

    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3444kb

input:

BBAAABABBAAABB

output:

3
3 6 7 

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 1ms
memory: 3396kb

input:

AABBBAAB

output:

2
2 4 

result:

ok 2 lines

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3488kb

input:

A

output:

0

result:

wrong answer 1st lines differ - expected: '1', found: '0'