結果

問題 No.988 N×Mマス計算(総和)
ユーザー mag
提出日時 2020-07-03 08:32:35
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 554 bytes
コンパイル時間 1,604 ms
コンパイル使用メモリ 168,220 KB
実行使用メモリ 13,760 KB
最終ジャッジ日時 2024-07-06 08:00:45
合計ジャッジ時間 5,964 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 4 WA * 6 TLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n,m,k;
  cin>>n>>m>>k;
  char op;
  cin>>op;
  vector<int> b(m),a(n);
  rep(i,m)cin>>b[i];
  rep(i,n)cin>>a[i];
  ll ans=0;
  if(op=='+'){
    rep(i,n){
      rep(j,m){
        ans+=a[i]+b[j];
      }
    }
    ans%=k;
  }else{
    rep(i,n){
      rep(j,m){
        ans+=a[i]*b[j];
      }
    }
    ans%=k;
  }
  cout<<ans<<endl;
}
0