Submission #00104


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<bits/stdc++.h>
#define np(v) next_permutation(v.begin(),v.end()) //次の順列
#define gcd(a,b) __gcd(a,b) //最大公約数
#define lcm(a,b) a/(gcd(a,b))*b //最小公倍数
#define lb(v,a) lower_bound(v.begin(),v.end(),a) //以上の最初
#define ub(v,a) upper_bound(v.begin(),v.end(),a) //越えの最初
#define bs(v,a) binary_search(v.begin(),v.end(),a) //値があるか
#define fixed(a) fixed<<setprecision(a) //小数点以下第 a + 1 を四捨五入
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<ll,int>;
using pq = priority_queue<P,vector<P>,greater<P>>;
const int inf = 1 << 30;
const ll ll_inf = 1LL << 62;
struct edge {
int c,to;
};
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
srand((unsigned int)time(NULL));
int n,m;
while(cin>>n>>m){
if(n == 0 && m == 0) break;
vector<int> a(n),b(m);
for(auto& i:a) cin>>i;
for(auto& i:b) cin>>i;
vector<int> ans(10,0);
for(int i = 0;i < n;i++){
for(int j = 0;j < m;j++){
ll x = a[i]*b[j];
//cout<<x<<" ";
while(x >= 1){
ans[x%10]++;
x /= 10;
}
}
}
for(int i = 0;i < 9;i++) cout<<ans[i]<<" ";
cout<<ans[9]<<"\n";
}
}

ステータス

項目 データ
問題 0004 - nmマス計算
ユーザー名 r2213
投稿日時 2024-03-29 12:15:43
言語 C++17
状態 Accepted
得点 20
ソースコード長 1411 Byte
最大実行時間 29 ms
最大メモリ使用量 676 KB

セット

セット 得点 Cases
1 ALL 20 / 20 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
A1 AC 26 ms 604 KB
1
A2 AC 29 ms 676 KB
1
A3 AC 27 ms 492 KB
1
A4 AC 22 ms 564 KB
1