結果

問題 No.987 N×Mマス計算(基本)
ユーザー 37zigen37zigen
提出日時 2020-02-14 21:37:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 339 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 2,249 ms
コンパイル使用メモリ 80,812 KB
実行使用メモリ 44,668 KB
最終ジャッジ日時 2024-04-16 01:37:19
合計ジャッジ時間 7,969 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 163 ms
42,648 KB
testcase_01 AC 160 ms
42,436 KB
testcase_02 AC 291 ms
44,324 KB
testcase_03 AC 218 ms
43,092 KB
testcase_04 AC 251 ms
43,780 KB
testcase_05 AC 246 ms
43,416 KB
testcase_06 AC 260 ms
44,136 KB
testcase_07 AC 238 ms
43,452 KB
testcase_08 AC 188 ms
42,632 KB
testcase_09 AC 192 ms
42,776 KB
testcase_10 AC 179 ms
42,940 KB
testcase_11 AC 270 ms
43,824 KB
testcase_12 AC 306 ms
44,276 KB
testcase_13 AC 241 ms
43,368 KB
testcase_14 AC 186 ms
42,904 KB
testcase_15 AC 233 ms
43,448 KB
testcase_16 AC 306 ms
44,168 KB
testcase_17 AC 266 ms
43,688 KB
testcase_18 AC 308 ms
44,028 KB
testcase_19 AC 339 ms
44,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int M=sc.nextInt();
		char op=sc.next().toCharArray()[0];
		long[] B=new long[M];
		long[] A=new long[N];
		for(int i=0;i<M;++i)B[i]=sc.nextLong();
		for(int i=0;i<N;++i)A[i]=sc.nextLong();
		for(int i=0;i<N;++i) {
			for(int j=0;j<M;++j) {
				long v=op=='*'?A[i]*B[j]:(A[i]+B[j]);
				System.out.print(v+(j==M-1?"\n":" "));
			}
		}
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}
0