結果

問題 No.987 N×Mマス計算(基本)
コンテスト
ユーザー kikage
提出日時 2020-03-06 01:51:06
言語 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
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 639 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 192 ms
コンパイル使用メモリ 39,168 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-01 12:57:35
合計ジャッジ時間 1,127 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <cstdio>
int main(){
    int N,M;
    long long A[100],B[100];
    char op;
    scanf("%d %d %c",&N,&M,&op);
    for(int i=0;i<M;i++)scanf("%ld",&B[i]);
    for(int i=0;i<N;i++)scanf("%ld",&A[i]);
    if(op=='+'){
        for(int i=0;i<N;i++){
            for(int k=0;k<M;k++){
                if(k>0)printf(" ");
                printf("%ld",A[i]+B[k]);
            }
            printf("\n");
        }
    }else {
        for(int i=0;i<N;i++){
            for(int k=0;k<M;k++){
                if(k>0)printf(" ");
                printf("%ld",A[i]*B[k]);
            }
            printf("\n");
        }
    }
    return 0;
}
0