QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#447358 | #8521. Pattern Search II | marher | WA | 0ms | 3692kb | C++14 | 431b | 2024-06-18 10:43:38 | 2024-06-18 10:43:39 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+50;
int n,len;
char s[N];
main()
{
// freopen("in.txt","r",stdin);
cin>>(s+1);n=strlen(s+1);len=n;
for(int i=1,cc=0;i<=n+1;i++)
{
if(s[i]==s[i-1])
{
cc++;
continue;
}
if(s[i-1]=='a')len+=(cc-1)/2;
if(s[i-1]=='b')len+=cc-1;
cc=1;
}
cout<<len<<'\n';
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
input:
aabbaab
output:
8
result:
ok 1 number(s): "8"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
a
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
b
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
aa
output:
2
result:
ok 1 number(s): "2"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
bb
output:
3
result:
ok 1 number(s): "3"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
ab
output:
2
result:
ok 1 number(s): "2"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
ba
output:
2
result:
ok 1 number(s): "2"
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3548kb
input:
bbba
output:
6
result:
wrong answer 1st numbers differ - expected: '7', found: '6'