結果

問題 No.988 N×Mマス計算(総和)
ユーザー mmn15277198
提出日時 2021-02-03 19:15:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 1,675 ms
コンパイル使用メモリ 169,620 KB
実行使用メモリ 817,848 KB
最終ジャッジ日時 2024-06-30 03:31:40
合計ジャッジ時間 4,767 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 4 WA * 4 MLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

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