QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#477551 | #8521. Pattern Search II | ucup-team1766# | WA | 0ms | 3804kb | C++23 | 479b | 2024-07-14 05:40:22 | 2024-07-14 05:40:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0)->sync_with_stdio(0);
string t; cin >> t; reverse(t.begin(), t.end());
int ans = 0;
if (t.back() == 'a') t.pop_back(), ans++;
if (t.back() == 'a') t.pop_back(), ans++;
while (t.size()) {
if (t.back() == 'b') t.pop_back();
ans++;
if (t.empty()) break;
if (t.back() == 'a') t.pop_back();
ans++;
if (t.empty()) break;
if (t.back() == 'a') t.pop_back(), ans++;
}
cout << ans << '\n';
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3604kb
input:
aabbaab
output:
8
result:
ok 1 number(s): "8"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
a
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
b
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
aa
output:
2
result:
ok 1 number(s): "2"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
bb
output:
3
result:
ok 1 number(s): "3"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
ab
output:
2
result:
ok 1 number(s): "2"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
ba
output:
2
result:
ok 1 number(s): "2"
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3644kb
input:
bbba
output:
6
result:
wrong answer 1st numbers differ - expected: '7', found: '6'