結果
| 問題 |
No.988 N×Mマス計算(総和)
|
| コンテスト | |
| ユーザー |
veqcc
|
| 提出日時 | 2020-02-14 22:09:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 2,000 ms |
| コード長 | 889 bytes |
| コンパイル時間 | 856 ms |
| コンパイル使用メモリ | 104,788 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-06 07:17:23 |
| 合計ジャッジ時間 | 1,992 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
int main() {
cin.sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, m;
ll k;
cin >> n >> m >> k;
char op;
cin >> op;
vector <ll> a(n), b(m);
ll sum_a = 0, sum_b = 0;
for (int i = 0; i < m; i++) {
cin >> b[i];
sum_b = (sum_b + b[i]) % k;
}
for (int i = 0; i < n; i++) {
cin >> a[i];
sum_a = (sum_a + a[i]) % k;
}
if (op == '+') {
cout << (sum_a * m + sum_b * n) % k << '\n';
} else {
cout << sum_a * sum_b % k << '\n';
}
return 0;
}
veqcc