QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#718094 | #9568. Left Shifting 3 | guangxuautumn | WA | 0ms | 3600kb | C++14 | 767b | 2024-11-06 19:40:37 | 2024-11-06 19:40:37 |
Judging History
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: 3600kb
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'