QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#802788#9568. Left Shifting 3JJJ_RE 1ms4020kbC++14554b2024-12-07 14:43:452024-12-07 14:43:45

Judging History

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

  • [2024-12-07 14:43:45]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:4020kb
  • [2024-12-07 14:43:45]
  • 提交

answer

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<bits/stdc++.h>
using namespace std;
char s[400005];
int main(){
	int t,n,k;
	cin>>t;
	while(t--){
		int ans=0;
		for(int i=0;i<400000;i++) s[i]=' ';
		cin>>n>>k;
		for(int i=1;i<=n;i++){
			cin>>s[i];
            if(i<=k)
			   s[i+n]=s[i];
		}
		for(int i=1;i<=n+k;i++){
			if(s[i]=='n' && s[i+1]=='a' && s[i+2]=='n' && s[i+3]=='j'
			   && s[i+4]=='i' && s[i+5]=='n' && s[i+6]=='g'){
				ans++;
			}
		}
		cout<<ans<<endl;
	} 
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4020kb

input:

4
21 10
jingicpcnanjingsuanan
21 0
jingicpcnanjingsuanan
21 3
nanjingnanjingnanjing
4 100
icpc

output:

2
1
3
0

result:

ok 4 number(s): "2 1 3 0"

Test #2:

score: -100
Runtime Error

input:

2130
39 7
nnananjingannanjingngnanjinganjinggjina
1 479084228
g
33 2
gqnanjinggrjdtktnanjingcvsenanjin
24 196055605
ginganjingnanjingnanjing
23 3
ngnanjinganjingjinnanji
40 3
njingaaznannanjingnananjingyonwpnanjinga
40 207842908
nanjinggphconanjingkonanjinannanjinglxna
46 3
ingjingnnanjingnanjinging...

output:

3

result: