結果

問題 No.988 N×Mマス計算(総和)
ユーザー kotatsugame
提出日時 2020-02-07 04:24:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 297 bytes
コンパイル時間 490 ms
コンパイル使用メモリ 65,060 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-06 06:50:40
合計ジャッジ時間 1,748 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int N,M;
char op;
long A[1<<17],B[1<<17];
long K,ans;
main()
{
	cin>>N>>M>>K;
	cin>>op;
	long Bs=0;
	for(int j=0;j<M;j++)
	{
		cin>>B[j];
		(Bs+=B[j])%=K;
	}
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		(ans+=op=='+'?A[i]*M+Bs:A[i]*Bs)%=K;
	}
	cout<<ans<<endl;
}
0