QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#625005 | #7618. Pattern Search | JustinWu# | WA | 0ms | 3900kb | C++14 | 531b | 2024-10-09 17:08:05 | 2024-10-09 17:08:05 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int T,a[400],b[400];
char s[2000005];
int main(){
scanf("%d",&T);
while(T--){
scanf("%s",s+1);
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
for(int i=1;i<=strlen(s+1);i++){
a[s[i]]++;
}
scanf("%s",s+1);
for(int i=1;i<=strlen(s+1);i++){
b[s[i]]++;
}
for(int i='a';i<='z';i++){
a[i]-=b[i]/2;
b[i]=b[i]/2+b[i]%2;
}
int mi=1e9;
for(int i='a';i<='z';i++){
if(b[i])mi=min(mi,a[i]/b[i]);
}
printf("%d\n",max(0,mi));
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3852kb
input:
2 bajkaaall aal abca cba
output:
2 1
result:
ok 2 number(s): "2 1"
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3900kb
input:
16 a a a b b a aa a ab aa ab b ab c aaz az abcde edcba aaaaaaaaaaaabbb aaaaaaaaabb aaaaaazz az aaaaaaaaaz zzzzz gggggggggggggggggggge ggggeeee hyphyphyphyphyphyphyphyphyphyphyphyp eeeeeeeeee hyphyphyphyphyphyphyphyphyphyphyphype eeteeteeteet aaaabbbbbbcccccccc aaabbbbbcccccc
output:
1 0 0 2 0 1 0 1 1 1 2 0 0 0 0 1
result:
wrong answer 10th numbers differ - expected: '2', found: '1'