結果
問題 | No.988 N×Mマス計算(総和) |
ユーザー |
![]() |
提出日時 | 2020-02-05 00:38:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 386 bytes |
コンパイル時間 | 2,639 ms |
コンパイル使用メモリ | 191,736 KB |
最終ジャッジ日時 | 2025-01-08 22:08:51 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; int main(){cin.tie(0);ios::sync_with_stdio(false); int N,M,K;cin>>N>>M>>K; string op;cin>>op; ll sa=0,sb=0; for(int i=0;i<M;++i){ int B;cin>>B; sb+=B; } sb%=K; for(int i=0;i<N;++i){ int A;cin>>A; sa+=A; } sa%=K; if(op=="+"){ cout<<(sa*M+sb*N)%K<<"\n"; }else{ cout<<sa*sb%K<<"\n"; } return 0; }