結果

問題 No.988 N×Mマス計算(総和)
コンテスト
ユーザー Y17
提出日時 2020-02-14 21:29:16
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
RE  
実行時間 -
コード長 621 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 853 ms
コンパイル使用メモリ 177,088 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-27 18:16:07
合計ジャッジ時間 2,796 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 RE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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