結果
問題 |
No.988 N×Mマス計算(総和)
|
ユーザー |
👑 |
提出日時 | 2020-07-01 14:16:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 88 ms / 2,000 ms |
コード長 | 675 bytes |
コンパイル時間 | 576 ms |
コンパイル使用メモリ | 65,616 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 08:00:34 |
合計ジャッジ時間 | 1,900 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
#include <iostream> #include<string> using namespace std; using ll = long long int; int main(void){ ll n, m, k, ans = 0; string ope; ll b = 0, a = 0, btmp; cin >> n >> m >> k >> ope; for(int i = 0; i < m; i++){ cin >> btmp; b += btmp; b %= k; } if (ope == "*"){ for(int i = 0; i < n; i++){ cin >> a; ans += a * b; ans %= k; } } else{ int atmp; for(int i = 0; i < n; i++){ cin >> atmp; a += atmp; a %= k; } ans = a * m + b * n; ans %= k; } cout << ans << endl; return 0; }