QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#779287 | #9568. Left Shifting 3 | Vamilio | WA | 5ms | 3800kb | C++14 | 612b | 2024-11-24 18:13:53 | 2024-11-24 18:13:55 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+100;
#define gc getchar()
#define rd read()
inline int read(){
int x=0,f=0; char c=gc;
for(;c<'0'||c>'9';c=gc) f|=(c=='-');
for(;c>='0'&&c<='9';c=gc) x=(x<<1)+(x<<3)+(c^48);
return f?-x:x;
}
int n,K,ans=0; string s,nj="nanjing"; char _s[N];
void solve(){
n=rd,K=rd,ans=0,scanf("%s", _s),s=_s;
for(int i=0;i+6<n;++i) if(s.substr(i,7)==nj) ++ans;
for(int i=1;i<=K&&i<=n&&i<=7;++i) if(s.substr(0,i)==nj.substr(7-i,i)) ++ans;
printf("%d\n", ans);
}
int main(){
int T=rd;
while(T--) solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3768kb
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: 5ms
memory: 3800kb
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 1 3 3 2 3 4 4 3 4 0 2 4 3 2 1 1 1 4 2 0 3 3 0 1 1 1 1 1 6 5 0 1 3 1 2 2 1 1 1 3 3 1 3 2 1 1 2 4 1 2 1 2 1 2 3 1 1 0 1 2 1 4 2 2 1 1 3 1 2 1 1 4 4 2 1 1 2 1 1 2 1 1 2 1 4 4 3 1 1 2 1 1 1 1 5 2 4 0 2 3 1 3 4 3 3 3 4 1 3 2 1 3 1 2 1 1 1 0 5 0 3 0 3 1 0 3 3 4 3 1 2 1 1 1 1 2 4 1 3 2 0 1 1 2 2 2 1 1 3 ...
result:
wrong answer 2nd numbers differ - expected: '0', found: '1'