結果

問題 No.987 N×Mマス計算(基本)
ユーザー erbowl
提出日時 2020-03-30 20:35:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 1,590 ms
コンパイル使用メモリ 168,556 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-23 02:27:24
合計ジャッジ時間 2,437 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,m;
    std::cin >> n>>m;
    
    char op;
    std::cin >> op;
    vector<ll> a(n),b(m);
    for (int i = 0; i < m; i++) {
        std::cin >> b[i];
    }
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if(op=='+'){
                std::cout << a[i]+b[j]<<" ";
            }else{
                std::cout << a[i]*b[j]<<" ";
            }
        }
        std::cout << std::endl;
    }
}

0