QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#600798 | #78. Eggfruit Cake | ship2077 | WA | 0ms | 3912kb | C++23 | 388b | 2024-09-29 19:22:07 | 2024-09-29 19:22:08 |
Judging History
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'