結果
問題 |
No.988 N×Mマス計算(総和)
|
ユーザー |
|
提出日時 | 2020-07-08 23:49:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 570 bytes |
コンパイル時間 | 1,592 ms |
コンパイル使用メモリ | 170,536 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 08:02:16 |
合計ジャッジ時間 | 2,655 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 3 WA * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n,m,k; cin>>n>>m>>k; string op; cin>>op; vector<int> va(n); vector<int> vb(m); rep(i,m) cin>>vb[i]; rep(i,n) cin>>va[i]; ll ans=0; if(op=="+"){ ll a=accumulate(va.begin(),va.end(),0); ll b=accumulate(vb.begin(),vb.end(),0); ans=(ll)(a*m+b*n)%k; } else { ll a=accumulate(va.begin(),va.end(),0); ll b=accumulate(vb.begin(),vb.end(),0); ans=(ll)(a*b)%k; } cout<<ans<<endl; }