Submission #00236
ソースコード
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 | #include <bits/stdc++.h> using namespace std; #define endl "\n" #define rep(i, a, b) for(int i = a; i < b; i++) #define rrep(i, a, b) for(int i = a; i >= b; i--) #define all(x) (x).begin(),(x).end() #define inf 1001001001 template < class T> bool chmax(T &a, const T &b) { if (a < b) {a = b; return true ;} return false ; } template < class T> bool chmin(T &a, const T &b) { if (b < a) {a = b; return true ;} return false ; } //================================================================================================ int main(){ int n, m; cin >> n >> m; while (n != 0 && m != 0){ int a[n], b[m], s, join[10] = {}; 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++){ s = a[i] * b[j]; if (s == 0){ join[0]++; } else { while (s > 0){ int d = s % 10; join[d]++; s /= 10; } } } } for ( int i = 0; i < 9; i++){ cout << join[i] << " " ; } cout << join[9] << endl; cin >> n >> m; } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0004 - nmマス計算 |
ユーザー名 | ei2212 |
投稿日時 | 2024-03-29 13:57:29 |
言語 | C++17 |
状態 | Accepted |
得点 | 20 |
ソースコード長 | 1383 Byte |
最大実行時間 | 37 ms |
最大メモリ使用量 | 600 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 20 / 20 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
A1 | AC | 29 ms | 600 KB |
1
|
A2 | AC | 37 ms | 576 KB |
1
|
A3 | AC | 36 ms | 544 KB |
1
|
A4 | AC | 30 ms | 392 KB |
1
|