結果

問題 No.987 N×Mマス計算(基本)
ユーザー mattyan0502mattyan0502
提出日時 2020-05-24 20:08:35
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,097 bytes
コンパイル時間 2,586 ms
コンパイル使用メモリ 76,644 KB
実行使用メモリ 44,624 KB
最終ジャッジ日時 2024-04-20 09:02:43
合計ジャッジ時間 8,500 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
41,408 KB
testcase_01 AC 153 ms
41,524 KB
testcase_02 AC 294 ms
43,100 KB
testcase_03 AC 223 ms
42,084 KB
testcase_04 AC 256 ms
42,892 KB
testcase_05 AC 250 ms
42,420 KB
testcase_06 AC 255 ms
43,168 KB
testcase_07 AC 232 ms
42,200 KB
testcase_08 AC 193 ms
41,560 KB
testcase_09 AC 196 ms
41,608 KB
testcase_10 WA -
testcase_11 AC 271 ms
42,880 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 181 ms
41,964 KB
testcase_15 AC 241 ms
42,376 KB
testcase_16 AC 319 ms
43,168 KB
testcase_17 WA -
testcase_18 AC 314 ms
44,312 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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();
        int B[] = new int[M];
        for(int i=0;i<M;i++)
        {
            B[i] = sc.nextInt();
        }
        for(int j=0;j<N;j++)
        {
            int C = sc.nextInt();
            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