Submission #00168


ソースコード

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
49
50
51
#include <bits/stdc++.h>
using namespace std;
#define st string
#define ll long long
#define ull unsigned long long
#define all(x) sort(x.begin(),x.end())
#define pq priority_queue<long long>
#define endl "\n"
#define gcd(x,y) __gcd(x,y) //最大公約数
#define lcm(x,y) x/(__gcd(x,y))*y //最小公倍数
const long long INF = 1LL << 60;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }
int main() {
int n, m;
while(1){
cin >> n >> m;
int a[n], b[m];
int sum[n][m];
int num[10] = {};
int amari;
string s;
if(n == 0 && m == 0){
break;
}
for(int i = 0;i < n;i++){
cin >> a[i];
}
for(int i = 0;i < m;i++){
cin >> b[i];
}
for(int i = 0;i < n;i++){
for(int j = 0;j < m;j++){
sum[i][j] = a[i] * b[j];
}
}
for(int i = 0;i < n;i++){
for(int j = 0;j < m;j++){
while(sum[i][j] > 0){
amari = sum[i][j] % 10;
sum[i][j] /= 10;
num[amari]++;
}
}
}
cout << num[0] << " " << num[1] << " " << num[2] << " " << num[3] << " " << num[4] << " " << num[5] << " " << num[6] << " " << num[7] << " " << num[8] << " " << num[9] << endl;
}
}

ステータス

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

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
A1 AC 28 ms 476 KB
1
A2 AC 27 ms 544 KB
1
A3 AC 29 ms 488 KB
1
A4 AC 31 ms 432 KB
1