結果
問題 | No.988 N×Mマス計算(総和) |
ユーザー |
![]() |
提出日時 | 2020-02-14 21:30:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 23 ms / 2,000 ms |
コード長 | 670 bytes |
コンパイル時間 | 578 ms |
コンパイル使用メモリ | 73,592 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 06:57:11 |
合計ジャッジ時間 | 1,422 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, k; cin >> n >> m >> k; char op; cin >> op; ll s = 0, t = 0; for (int j = 0; j < m; j++) { int b; cin >> b; s += b; } for (int i = 0; i < n; i++) { int a; cin >> a; t += a; } s %= k; t %= k; if (op == '+') { cout << (s * n + t * m) % k << endl; } else { cout << s * t % k << endl; } return 0; }