Skip to content

Instantly share code, notes, and snippets.

@key-moon

key-moon/a.cpp Secret

Created October 25, 2020 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save key-moon/870915051f6726f9d0a0d5f87ceb2887 to your computer and use it in GitHub Desktop.
Save key-moon/870915051f6726f9d0a0d5f87ceb2887 to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
#define var auto
using namespace std;
int main(){
int n, m;
cin >> n >> m;
if (n == 0) return 0;
vector<int> as(n);
for (int i = 0; i < n; i++){
cin >> as[i];
}
vector<int> bs(m);
for (int i = 0; i < m; i++){
cin >> bs[i];
}
vector<int> res(10, 0);
for (var&& a : as){
for (var&& b : bs){
var val = a * b;
while (val != 0){
res[val % 10]++;
val /= 10;
}
}
}
for (int i = 0; i < 10; i++){
if (i != 0) cout << " ";
cout << res[i];
}
cout << endl;
main();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment