QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#765811 | #9568. Left Shifting 3 | XingKongC# | WA | 4ms | 3712kb | C++20 | 935b | 2024-11-20 15:19:58 | 2024-11-20 15:19:59 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(x) for(ll i = 1; i <= x; i ++)
void solve(){
ll n, k;
cin >> n >> k;
string s;
cin >> s;
s = s + s;
ll ans1 = 0;
// cerr << s << endl;
if(n < 7) { cout << 0 << endl;return ; }
vector<ll> a(n + 1);
for(int i = 0; i < n - 7 + 1 ; i ++){
if(s.substr(i, 7) == "nanjing"){
ans1 ++;
i += 6;
}
}
for(int i = n - 6; i < 2 * n - 6; i ++){
if(s.substr(i, 7) == "nanjing"){
a[i - (n - 7)] ++;
i += 6;
}
}
f(n){
a[i] += a[i - 1];
}
cout << ans1 + k / n * a[n] + a[k % n] << endl;
}
int main (){
ios :: sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
cin >> t;
while(t--) {
solve();
}
return 0;
}
//nanjingnanjing
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3564kb
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: 3712kb
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 16337968 2 3 15588221 4 23764091 4 0 29208677 6602306 2513133 43872732 16487110 1 86250325 50859387 78671526 0 6544639 15241050 0 0 10613887 0 0 0 19792855 16689637 0 61720319 8765020 1 8643930 40157294 1 1 1 3 3 1 3 50328288 0 1 2 81975839 34772645 2 35947570 28629811 1 2 62064496 0 33811930 ...
result:
wrong answer 4th numbers differ - expected: '2', found: '16337968'