QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#797872 | #9574. Strips | MiaoYu | WA | 0ms | 3612kb | C++14 | 650b | 2024-12-03 20:04:40 | 2024-12-03 20:04:40 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N=5e5+10;
int T,n,k,ans;
char nanjing[7] = {'n', 'a', 'n', 'j', 'i', 'n', 'g'};
char s[N];
int main()
{
cin>>T;
while(T--)
{
cin>>n>>k;
if(n<7)
{
cout<<0<<endl;
continue;
}
ans=0;
for(int i=0;i<n;i++)
{
cin>>s[i];
}
for(int i=0;i<=n-7+min(k,6);i++)
{
for(int j=0;j<7;j++)
{
if(s[(i+j)%n]!=nanjing[j])break;
if(j==6)ans++;
}
}
cout<<ans<<endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3612kb
input:
4 5 2 3 16 7 11 2 9 14 13 5 3 2 4 11 6 10 2 1 11 2 1 2 6 1 5 3 2 1 2 6 1 5 2
output:
0 0 0 0
result:
wrong answer There is no stripe covering red cell 2 (test case 1)