Submission #00148
ソースコード
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 | #include <bits/stdc++.h> using namespace std; int main () { int n,m; int a[100]={},b[100]={}; int ans; int cnt[10]={}; int i,j; while (1){ cin>>n>>m; if (n==m && n==0){ break ; } for (i=0;i<n;i++){ cin>>a[i]; } for (i=0;i<m;i++){ cin>>b[i]; } for (i=0;i<n;i++){ for (j=0;j<m;j++){ ans=(a[i]*b[j]); do { cnt[(ans)%10]++; ans=ans/10; } while (ans%10 != ans); if (ans!=0){ cnt[ans]++; } } } for (i=0;i<9;i++){ cout<<cnt[i]<< " " ; cnt[i]=0; } cout<<cnt[9]<< "\n" ; cnt[9]=0; } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0004 - nmマス計算 |
ユーザー名 | ei2205 |
投稿日時 | 2024-03-29 12:40:47 |
言語 | C++17 |
状態 | Accepted |
得点 | 20 |
ソースコード長 | 871 Byte |
最大実行時間 | 40 ms |
最大メモリ使用量 | 648 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 20 / 20 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
A1 | AC | 40 ms | 348 KB |
1
|
A2 | AC | 34 ms | 576 KB |
1
|
A3 | AC | 34 ms | 548 KB |
1
|
A4 | AC | 35 ms | 648 KB |
1
|