結果
| 問題 |
No.988 N×Mマス計算(総和)
|
| ユーザー |
|
| 提出日時 | 2020-07-08 23:56:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 22 ms / 2,000 ms |
| コード長 | 391 bytes |
| コンパイル時間 | 1,218 ms |
| コンパイル使用メモリ | 166,080 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 08:02:19 |
| 合計ジャッジ時間 | 2,167 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n,m,k;
cin>>n>>m>>k;
char op; cin>>op;
ll A=0, B=0; int t;
rep(i,m){cin>>t; B+=t;}
rep(i,n){cin>>t; A+=t;}
ll ans=0;
A%=k, B%=k;
if(op=='+') ans=(m*A%k+n*B%k)%k;
else ans=A*B%k;
cout<<ans<<endl;
}