QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#477551#8521. Pattern Search IIucup-team1766#WA 0ms3804kbC++23479b2024-07-14 05:40:222024-07-14 05:40:22

Judging History

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

  • [2024-07-14 05:40:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3804kb
  • [2024-07-14 05:40:22]
  • 提交

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'