結果

問題 No.988 N×Mマス計算(総和)
ユーザー CELICA
提出日時 2020-07-02 20:41:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 540 bytes
コンパイル時間 1,536 ms
コンパイル使用メモリ 167,196 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-06 08:00:37
合計ジャッジ時間 2,601 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using ll = long long;

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n,m,k;
    string op;
    cin >> n >> m >> k >> op;

    ll a,b,sa{0},sb{0},res;
    
    for (int i=0;i<m;++i)
    {
        cin >> b;
        sb+=b;
    }
    for (int i=0;i<n;++i)
    {
        cin >> a;
        sa+=a;
    }
    
    if (op == "+")
    {
        res=(sa*m+sb*n) % k;
    }
    else
    {
        res=((sa % k)*(sb % k)) % k;
    }

    cout << res << "\n";

    return 0;
}
0