結果

問題 No.988 N×Mマス計算(総和)
ユーザー mmn15277198mmn15277198
提出日時 2021-02-03 19:15:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 1,490 ms
コンパイル使用メモリ 169,080 KB
実行使用メモリ 814,680 KB
最終ジャッジ日時 2023-09-12 15:35:36
合計ジャッジ時間 5,915 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
4,384 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 MLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
	int n , m , k;
	cin >> n >> m >> k;
	char op;
	vector<int> a(m) , b(n);
	cin >> op;
	for(int i = 0; i < m; i++){
	    cin >> a[i];
	}
	for(int i = 0; i < n; i++){
	    cin >> b[i];
	}
	
	vector<int> c;
	for(int i = 0; i < m; i++){
	    for(int j = 0; j < n; j++){
	        int now;
	        if(op == '+')now = a[i] + b[j];
	        else now = a[i] * b[j];
	        now %= k;
	        c.push_back(now);
	    }
	}
	int ans = 0;
	for(int i = 0; i < c.size(); i++){
	    ans += c[i];
	    ans %= k;
	}
	cout << ans << endl;
	return 0;
}
0