結果
問題 |
No.988 N×Mマス計算(総和)
|
ユーザー |
![]() |
提出日時 | 2020-02-28 22:45:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 557 bytes |
コンパイル時間 | 1,244 ms |
コンパイル使用メモリ | 166,544 KB |
実行使用メモリ | 13,756 KB |
最終ジャッジ日時 | 2024-07-06 07:32:32 |
合計ジャッジ時間 | 5,550 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | WA * 10 TLE * 1 -- * 8 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m, k; cin >> n >> m >> k; char op; cin >> op; int ans = 0; long long a[n], b[m]; for(int i = 0; i < m; i++) { cin >> b[i]; } for(int i = 0; i < n; i++) { cin >> a[i]; } if(op == '+') { for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { ans += (a[i] + b[j]); } } } if( op == '*') { for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { ans += a[i] * b[j]; } } } cout << ans % k << endl; }