結果

問題 No.988 N×Mマス計算(総和)
ユーザー kpinkcat
提出日時 2023-08-23 18:15:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 704 bytes
コンパイル時間 859 ms
コンパイル使用メモリ 102,616 KB
最終ジャッジ日時 2025-02-16 12:37:55
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 4 WA * 4 TLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

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;
    string op;
    cin >> n >> m >> k >> op;
    vector<int> hori(m), ver(n);
    for (int i = 0; i < m; i++) cin >> hori[i];
    for (int i = 0; i < n; i++) cin >> ver[i];    
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            if (op == "+"){
                sum1 += (hori[j] + ver[i]);
                sum1 %= k;
            } else {
                sum1 += (hori[j] * ver[i]);
                sum1 %= k;
            }
        }
    }
    cout << sum1 << endl;
}
0