結果

問題 No.988 N×Mマス計算(総和)
ユーザー kiefer_von_mauskiefer_von_maus
提出日時 2020-02-28 23:02:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 1,402 ms
コンパイル使用メモリ 168,344 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-06 07:32:23
合計ジャッジ時間 2,174 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, m, k;
	cin >> n >> m >> k;
	char op;
	cin >> op;
	long long ans = 0;
	long long a[n], b[m];
	long long row = 0, column = 0;
	for(int i = 0; i < m; i++) {
		cin >> b[i];
		row += b[i];
	}
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		column += a[i];
	}

	if(op == '+') {
		for(int i = 0; i < n; i++) {
			ans += a[i] * m;
		}
		for(int i = 0; i < m; i++) {
			ans += b[i] * n;
		}
	}
	if(op == '*') {
		for(int i = 0; i < n; i++) {
			ans += a[i] * row;
		}
	}
	cout << ans % k << endl;
}
0