結果
問題 |
No.988 N×Mマス計算(総和)
|
ユーザー |
|
提出日時 | 2021-02-03 22:06:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 22 ms / 2,000 ms |
コード長 | 504 bytes |
コンパイル時間 | 1,701 ms |
コンパイル使用メモリ | 192,932 KB |
最終ジャッジ日時 | 2025-01-18 11:11:13 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> int64_t input(int limit, int mod) { int64_t res = 0; for (int i = 0; i < limit; ++i) { int64_t tmp; std::cin >> tmp; res += tmp; res %= mod; } return res; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int n, m, k; std::cin >> n >> m >> k; char op; std::cin >> op; int64_t b = input(m, k), a = input(n, k); int ans; if (op == '+') { ans = (a * m + b * n) % k; } else { ans = a * b % k; } std::cout << ans << std::endl; }