QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#600798#78. Eggfruit Cakeship2077WA 0ms3912kbC++23388b2024-09-29 19:22:072024-09-29 19:22:08

Judging History

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

  • [2024-09-29 19:22:08]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3912kb
  • [2024-09-29 19:22:07]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int M=2e5+5,inf=0x3f3f3f3f;
int n,len;char str[M];long long ans;
int main(){
    scanf("%s%d",str,&n);len=strlen(str);
    for (int i=0;i<len;i++) str[i+len]=str[i];
    for (int i=len,p=-inf;i<len<<1;i++){
        if (str[i]=='E') p=i;
        if (i-n+1<=p) ans+=p-(i-n);
    }
    printf("%lld\n",ans);
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3772kb

input:

PEPEP
2

output:

6

result:

ok single line: '6'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3912kb

input:

PPPPPPPPPPPPPPPPPPPP
10

output:

0

result:

ok single line: '0'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

EEEEEEEEEEEEEEEEEEEEE
11

output:

231

result:

ok single line: '231'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3896kb

input:

PPPPPPPPPPPPPPPPPPPPPP
12

output:

0

result:

ok single line: '0'

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3772kb

input:

PPEEPPEPEEPPPEPEEEPEEEP
13

output:

260

result:

wrong answer 1st lines differ - expected: '281', found: '260'