QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#710042#9568. Left Shifting 3ehdxbc#WA 4ms3780kbC++20445b2024-11-04 18:13:582024-11-04 18:13:58

Judging History

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

  • [2024-11-04 18:13:58]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3780kb
  • [2024-11-04 18:13:58]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

void solve() {
   int n, k;
   cin >> n >> k;
   string s;
   cin >> s;
   k = min(n, k);
   s += s.substr(0, k);
   int ans = 0;
   for (int i = 0; i < n + k; i++) {
      if (s.substr(i, 7) == "nanjing") ans++;
   }
   cout << ans << endl;
}
signed main() {
   ios::sync_with_stdio(false);
   cin.tie(nullptr);
   int t;
   cin >> t;
   while (t--) {
      solve();
   }
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3780kb

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
Wrong Answer
time: 4ms
memory: 3708kb

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
0
3
4
2
3
6
4
6
4
0
4
8
5
4
2
1
1
7
3
0
5
5
0
0
1
0
0
0
10
8
0
1
4
1
3
3
1
1
1
3
3
1
3
3
0
1
2
8
1
2
1
3
1
2
5
0
1
0
0
2
1
3
2
3
1
0
3
1
3
1
1
4
7
1
1
1
1
0
1
2
2
1
3
0
8
8
6
1
1
2
1
2
1
1
9
2
7
0
2
4
1
3
7
3
5
6
6
1
3
4
2
6
1
3
0
0
1
0
9
0
4
0
6
2
0
2
4
3
4
2
3
0
1
1
1
3
4
1
3
3
0
1
1
2
4
2
1
0
6...

result:

wrong answer 4th numbers differ - expected: '2', found: '4'