开始把题意看错了,把数组多开了100000000倍,结果直接运行不了,运行框都不出来了...⊙﹏⊙b汗
附ac代码:
#include <stdio.h>
#include <string.h>
#define MAX 11
char a[MAX], b[MAX];
int main(){
int t;
long long s;
scanf("%d", &t);
while(t-- && scanf("%s%s", a, b)){
s = 0;
int m = strlen(a), n = strlen(b);
for(int i = 0; i != m; ++i){
if(a[i] == '0') continue;
for(int j = 0; j != n; ++j){
if(b[j] == '0') continue;
s += (a[i] - '0') * (b[j] - '0');
}
}
printf("%lld\n", s);
}
return 0;
}