結果
問題 | No.988 N×Mマス計算(総和) |
ユーザー |
👑 |
提出日時 | 2020-02-14 21:26:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 77 ms / 2,000 ms |
コード長 | 528 bytes |
コンパイル時間 | 461 ms |
コンパイル使用メモリ | 70,236 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 06:52:57 |
合計ジャッジ時間 | 1,621 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
#include <iostream> #include <vector> using namespace std; int main(){ long long n,m,k;cin>>n>>m>>k; char z;cin>>z; vector<long long> A(n); long long sm = 0LL; vector<long long> B(m); for(int i = 0; m > i; i++){ cin>>B[i]; sm = (sm+B[i])%k; } long long ans = 0LL; for(int i = 0; n > i; i++){ cin>>A[i]; if(z == '+'){ ans = (ans+(sm+A[i]*m))%k; }else{ ans = (ans+(sm*A[i]))%k; } } cout << ans << endl; }