QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#718077#9568. Left Shifting 3guangxuautumnWA 0ms3732kbC++14767b2024-11-06 19:38:272024-11-06 19:38:28

Judging History

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

  • [2024-11-06 19:38:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3732kb
  • [2024-11-06 19:38:27]
  • 提交

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;

	if(n <= 6) {
		cout << "0\n";
		return;
	}

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

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

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

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

	while(t--)
		solve();

	return 0;
}

詳細信息

Test #1:

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

input:

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

output:

5
3
6
0

result:

wrong answer 1st numbers differ - expected: '2', found: '5'