結果

問題 No.987 N×Mマス計算(基本)
ユーザー mattyan0502mattyan0502
提出日時 2020-05-24 20:10:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 338 ms / 2,000 ms
コード長 1,100 bytes
コンパイル時間 2,371 ms
コンパイル使用メモリ 86,224 KB
実行使用メモリ 44,708 KB
最終ジャッジ日時 2024-04-20 09:05:04
合計ジャッジ時間 8,202 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
41,724 KB
testcase_01 AC 152 ms
41,336 KB
testcase_02 AC 294 ms
43,352 KB
testcase_03 AC 215 ms
42,348 KB
testcase_04 AC 251 ms
42,932 KB
testcase_05 AC 241 ms
42,680 KB
testcase_06 AC 260 ms
43,328 KB
testcase_07 AC 227 ms
42,628 KB
testcase_08 AC 185 ms
41,836 KB
testcase_09 AC 193 ms
41,852 KB
testcase_10 AC 198 ms
41,796 KB
testcase_11 AC 276 ms
43,044 KB
testcase_12 AC 305 ms
43,056 KB
testcase_13 AC 232 ms
42,336 KB
testcase_14 AC 176 ms
41,748 KB
testcase_15 AC 237 ms
43,148 KB
testcase_16 AC 312 ms
43,272 KB
testcase_17 AC 266 ms
43,016 KB
testcase_18 AC 318 ms
43,312 KB
testcase_19 AC 338 ms
44,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        String op = sc.next();
        long B[] = new long[M];
        for(int i=0;i<M;i++)
        {
            B[i] = sc.nextInt();
        }
        for(int j=0;j<N;j++)
        {
            long C = sc.nextLong();
            for(int k=0;k<M;k++)
            {
                if(op.equals("+"))
                {
                    if(k<M-1)
                    {
                        System.out.print(B[k] + C +" ");
                    }else{
                        System.out.print(B[k] + C);
                    }
                }
                else{
                    if(k<M-1)
                    {
                        System.out.print(B[k] * C +" ");
                    }else{
                        System.out.print(B[k] * C);
                    }
                }
            }
            System.out.println("");
        }
    }
}
0