結果
問題 |
No.988 N×Mマス計算(総和)
|
ユーザー |
![]() |
提出日時 | 2020-02-28 22:46:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 563 bytes |
コンパイル時間 | 1,225 ms |
コンパイル使用メモリ | 167,064 KB |
実行使用メモリ | 11,300 KB |
最終ジャッジ日時 | 2024-07-06 07:32:40 |
合計ジャッジ時間 | 5,541 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 4 WA * 6 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; long long 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; }