結果

問題 No.988 N×Mマス計算(総和)
ユーザー KKT89KKT89
提出日時 2020-02-14 21:57:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 573 bytes
コンパイル時間 986 ms
コンパイル使用メモリ 85,912 KB
最終ジャッジ日時 2025-01-09 00:11:04
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <numeric>
#include <queue>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,m; cin >> n >> m;
	ll k; cin >> k;
	ll ans=0;
	char c; cin >> c;
	vector<ll> b(m),a(n);
	for(int i=0;i<m;i++){
		cin >> b[i];
	}
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(c=='+'){
				ans+=a[i]+b[j];
			}
			else{
				ans+=a[i]*b[j];
			}
			ans%=k;
		}
	}
	cout << ans << endl;
}
0