QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#717797 | #9568. Left Shifting 3 | guangxuautumn | WA | 0ms | 3464kb | C++14 | 747b | 2024-11-06 18:58:17 | 2024-11-06 18:58:25 |
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;
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;
}
Details
Tip: Click on the bar to expand more detailed information
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'