結果

問題 No.988 N×Mマス計算(総和)
ユーザー kpinkcatkpinkcat
提出日時 2023-08-23 18:33:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 735 bytes
コンパイル時間 906 ms
コンパイル使用メモリ 105,500 KB
実行使用メモリ 4,652 KB
最終ジャッジ日時 2023-08-23 18:33:15
合計ジャッジ時間 2,563 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 24 ms
4,376 KB
testcase_11 AC 35 ms
4,376 KB
testcase_12 AC 59 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 27 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 33 ms
4,376 KB
testcase_19 AC 54 ms
4,376 KB
testcase_20 AC 81 ms
4,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
using namespace std;


int main()
{
    long long n, m, k, sum1= 0, sum2 = 0;
    string op;
    cin >> n >> m >> k >> op;
    vector<long long> hori(m), ver(n);
    for (int i = 0; i < m; i++){
        cin >> hori[i];
        sum2 += hori[i];
        sum2 %= k;
    }
    for (int i = 0; i < n; i++) cin >> ver[i];
    if (op == "+"){
        for (int i = 0; i < n; i++){
            sum1 += sum2 * ver[i];
            sum1 %= k;
        }
    } else {
        for (int i = 0; i < n; i++){
            sum1 += sum2 * ver[i];
            sum1 %= k;
        }
    }
    cout << sum1%k << endl;
}
0