結果

問題 No.988 N×Mマス計算(総和)
ユーザー Y17Y17
提出日時 2020-02-14 21:29:16
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 621 bytes
コンパイル時間 1,358 ms
コンパイル使用メモリ 144,112 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-20 11:31:52
合計ジャッジ時間 3,917 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long

signed main(){

    int n, m;
    cin >> n >> m;
    int k;
    cin >> k;

    char op;
    cin >> op;

    int a[110];
    int b[110];
    int sum = 0;

    for(int i = 0;i < m;i++){
        cin >> b[i];
        sum = (sum + b[i]) % k;
    }

    for(int i = 0;i < n;i++) cin >> a[i];

    int ans = 0;
    for(int i = 0;i < n;i++){
        if(op == '+'){
            ans += a[i] * m % k + sum; 
            ans %= k;
        }else{
            ans += a[i] * sum % k;
            ans %= k;
        }
    }
	
    cout << ans << endl;

    return 0;
}
0