QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#770874#9568. Left Shifting 3RUOHUIWA 7ms3808kbC++20999b2024-11-22 01:01:332024-11-22 01:01:34

Judging History

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

  • [2024-11-22 01:01:34]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3808kb
  • [2024-11-22 01:01:33]
  • 提交

answer

#include "bits/stdc++.h"
#define int long long
#define ull unsigned long long
#define PII pair<int, int>
#define TIII tuple<int, int, int>
#define LL __int128
#define eps 1e-6
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
constexpr int N = 2e6 + 10, M = 2e6 + 10, mod = 1e9 + 7, inf = 1e18;
int n, m;

void solve()
{
    int k;
    cin >> n >> k;
    string s;
    cin >> s;
    int ans = 0;
    s += s.substr(0, min(k, 7LL));
    for (int i = 0; i < s.size(); i++)
    {
        if (s.substr(i, 7) == "nanjing")
            ans++;
    }
    cout << ans << endl;
}

signed main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(2);

#ifndef ONLINE_JUDGE
    freopen("in.txt", "rt", stdin);
    freopen("out.txt", "wt", stdout);
#endif

    int Cases = 1;
    cin >> Cases;
    while (Cases--)
    {
        solve();
    }
    return 0;
}

詳細信息

Test #1:

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

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: 7ms
memory: 3600kb

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
2
2
3
4
4
3
4
0
2
4
3
2
1
1
1
4
2
0
3
3
0
0
1
0
0
0
5
5
0
1
2
1
2
2
1
1
1
3
3
1
3
2
0
1
2
4
1
2
1
2
1
2
3
0
1
0
0
2
1
3
2
2
1
0
3
1
2
1
1
4
4
1
1
1
1
0
1
1
1
1
2
0
4
4
3
1
1
2
1
1
1
1
5
1
4
0
1
2
1
3
4
3
3
3
3
1
3
2
1
3
1
2
0
0
1
0
5
0
2
0
3
1
0
2
2
3
2
1
2
0
1
1
1
2
4
1
3
2
0
1
1
2
2
2
1
0
3
...

result:

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