結果

問題 No.988 N×Mマス計算(総和)
ユーザー chocoruskchocorusk
提出日時 2020-02-15 04:37:53
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 997 bytes
コンパイル時間 883 ms
コンパイル使用メモリ 108,016 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-20 12:03:31
合計ジャッジ時間 3,428 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n, m;ll k;
	cin>>n>>m>>k;
	char op; cin>>op;
	ll a[101], b[101];
	for(int i=0; i<m; i++) cin>>b[i];
	for(int i=0; i<n; i++){
		cin>>a[i];
	}
	if(op=='+'){
		ll ans=0;
		for(int i=0; i<n; i++){
			(ans+=a[i]*m)%=k;
		}
		for(int i=0; i<m; i++){
			(ans+=b[i]*n)%=k;
		}
		cout<<ans<<endl;
		return 0;
	}
	ll sa=0, sb=0;
	for(int i=0; i<n; i++) sa+=a[i];
	for(int j=0; j<m; j++) sb+=b[j];
	sa%=k, sb%=k;
	cout<<(sa*sb%k)<<endl;
	return 0;
}
0