QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#717797#9568. Left Shifting 3guangxuautumnWA 0ms3464kbC++14747b2024-11-06 18:58:172024-11-06 18:58:25

Judging History

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

  • [2024-11-06 18:58:25]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3464kb
  • [2024-11-06 18:58:17]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

void solve()
{
	int n, k;
	cin >> n >> k;

	string s;
	cin >> s;

	s = s + s;

	int cnt = 0;

	string nanjing = "nanjing";

	//cout << s << endl;

	int last = min(n + min(k, 6), n * 2);

	for(int i = 0; i < last; i ++) {
		//cout << i << ' ';
		if(s[i] == 'n' && i + 7 <= last) {
			//cout << i << ' ';
			bool flag = 0;
			for(int j = i; j < 7; j ++) {
			//	cout << "what";
				if(s[i] == nanjing[j - i]) continue;
				else {
					flag = 1;
					break;
				}
			}
			if(flag == 0) {
				//cout << i << ' ';
				cnt ++;	
				i = i + 6;
			}
		}
	}

	cout << cnt << '\n';
}

int main()
{
	int t;
	cin >> t;

	while(t--)
		solve();

	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3464kb

input:

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

output:

2
1
2
0

result:

wrong answer 3rd numbers differ - expected: '3', found: '2'