QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#447358#8521. Pattern Search IImarherWA 0ms3692kbC++14431b2024-06-18 10:43:382024-06-18 10:43:39

Judging History

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

  • [2024-06-18 10:43:39]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3692kb
  • [2024-06-18 10:43:38]
  • 提交

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';
}

Details

Tip: Click on the bar to expand more detailed information

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'