結果

問題 No.988 N×Mマス計算(総和)
ユーザー kpinkcatkpinkcat
提出日時 2023-08-23 18:20:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 710 bytes
コンパイル時間 1,218 ms
コンパイル使用メモリ 102,080 KB
最終ジャッジ日時 2025-02-16 12:38:58
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 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<long long> 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