QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#797872#9574. StripsMiaoYuWA 0ms3612kbC++14650b2024-12-03 20:04:402024-12-03 20:04:40

Judging History

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

  • [2024-12-03 20:04:40]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3612kb
  • [2024-12-03 20:04:40]
  • 提交

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)