結果

問題 No.987 N×Mマス計算(基本)
ユーザー rymg111rymg111
提出日時 2020-09-22 21:45:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 331 ms / 2,000 ms
コード長 767 bytes
コンパイル時間 2,098 ms
コンパイル使用メモリ 74,124 KB
実行使用メモリ 60,236 KB
最終ジャッジ日時 2023-09-09 04:16:10
合計ジャッジ時間 7,782 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,356 KB
testcase_01 AC 123 ms
53,736 KB
testcase_02 AC 282 ms
57,716 KB
testcase_03 AC 188 ms
55,928 KB
testcase_04 AC 267 ms
57,828 KB
testcase_05 AC 260 ms
55,572 KB
testcase_06 AC 276 ms
58,132 KB
testcase_07 AC 203 ms
56,152 KB
testcase_08 AC 169 ms
56,560 KB
testcase_09 AC 172 ms
55,848 KB
testcase_10 AC 180 ms
55,960 KB
testcase_11 AC 275 ms
58,252 KB
testcase_12 AC 295 ms
59,336 KB
testcase_13 AC 206 ms
56,016 KB
testcase_14 AC 157 ms
55,880 KB
testcase_15 AC 208 ms
55,892 KB
testcase_16 AC 298 ms
57,740 KB
testcase_17 AC 268 ms
56,244 KB
testcase_18 AC 298 ms
59,852 KB
testcase_19 AC 331 ms
60,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int raws = sc.nextInt();
		int columns = sc.nextInt();
		String op = sc.next();
		long[] rawNum = new long[raws];
		long[] colNum = new long[columns];
		for(int i = 0; i < columns; i++) {
			colNum[i] = sc.nextInt();
		}
		for(int j = 0; j < raws; j++) {
			rawNum[j] = sc.nextInt();
		}
		for(int k = 0; k < raws; k++) {
			for(int l = 0; l < columns; l++) {
				calculate(op, rawNum[k], colNum[l]);
				System.out.print(" ");
			}
			System.out.println("");
		}
	}
	public static void calculate(String op, long raw, long col) {
		if(op.equals("*")) {
			System.out.print(raw * col);
		} else {
			System.out.print(raw + col);
		}
	}
}
0