結果

問題 No.988 N×Mマス計算(総和)
ユーザー pyranine
提出日時 2020-12-21 11:58:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 1,786 ms
コンパイル使用メモリ 164,920 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-21 12:50:24
合計ジャッジ時間 3,343 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  char op;
  cin >> op;
  int64_t a = 0, b = 0;
  int t;
  for (int i = 0; i < m; i++) {
    cin >> t;
    b += t;
  }
  for (int i = 0; i < n; i++) {
    cin >> t;
    a += t;
  }
  int64_t ans = 0;
  a %= k;
  b %= k;
  if (op == '+') ans = (m * a % k + n * b % k) % k;
  else ans = a * b % k;
  cout << ans << '\n';
  return 0;
}
0