QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#217543 | #5596. I Could Have Won | Viktor# | WA | 1ms | 3460kb | C++14 | 1014b | 2023-10-16 23:09:46 | 2023-10-16 23:09:47 |
Judging History
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;
}
if (pos > 0) {
cout << pos << endl;
cout << rounds[0];
for (int i = 1; i < pos; i++) {
cout << " " << rounds[i];
}
cout << endl;
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3404kb
input:
BBAAABABBAAABB
output:
3 3 6 7
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3460kb
input:
AABBBAAB
output:
2 2 4
result:
ok 2 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3416kb
input:
A
output:
1 1
result:
ok 2 lines
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3328kb
input:
B
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''