結果
問題 | No.988 N×Mマス計算(総和) |
ユーザー |
![]() |
提出日時 | 2020-02-14 21:37:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 75 ms / 2,000 ms |
コード長 | 444 bytes |
コンパイル時間 | 415 ms |
コンパイル使用メモリ | 65,788 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 07:02:12 |
合計ジャッジ時間 | 1,622 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
#include <iostream> #include <vector> using namespace std; typedef long long ll; int main() { int n, m, k; cin >> n >> m >> k; char op; cin >> op; ll sumb = 0; for (int i = 0; i < m; i++) { ll b; cin >> b; sumb = (sumb + b) % k; } ll ans = 0; for (int i = 0; i < n; i++) { ll a; cin >> a; if (op == '+') ans = (ans + a * m + sumb) % k; else ans = (ans + a * sumb) % k; } cout << ans << endl; }