結果

問題 No.987 N×Mマス計算(基本)
ユーザー ParSAParSA
提出日時 2020-02-14 21:57:00
言語 Java19
(openjdk 21)
結果
AC  
実行時間 328 ms / 2,000 ms
コード長 769 bytes
コンパイル時間 3,599 ms
コンパイル使用メモリ 75,884 KB
実行使用メモリ 59,948 KB
最終ジャッジ日時 2023-07-28 17:55:11
合計ジャッジ時間 8,013 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
56,108 KB
testcase_01 AC 139 ms
56,360 KB
testcase_02 AC 266 ms
56,548 KB
testcase_03 AC 200 ms
56,244 KB
testcase_04 AC 235 ms
56,228 KB
testcase_05 AC 234 ms
55,876 KB
testcase_06 AC 243 ms
56,664 KB
testcase_07 AC 221 ms
56,256 KB
testcase_08 AC 179 ms
56,188 KB
testcase_09 AC 179 ms
56,148 KB
testcase_10 AC 174 ms
55,996 KB
testcase_11 AC 255 ms
56,248 KB
testcase_12 AC 303 ms
56,828 KB
testcase_13 AC 233 ms
56,228 KB
testcase_14 AC 181 ms
56,036 KB
testcase_15 AC 228 ms
56,624 KB
testcase_16 AC 304 ms
56,808 KB
testcase_17 AC 250 ms
57,048 KB
testcase_18 AC 304 ms
56,812 KB
testcase_19 AC 328 ms
59,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt(); //n行
		
		int m = stdIn.nextInt(); //m列
		
		
		String op = stdIn.next();
		
		int[] b = new int[m];
		
		for(int i = 0; i < m; i++) {
			b[i] = stdIn.nextInt();
		}
		
		int[] a = new int[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = stdIn.nextInt();
		}
		
		if(op.equals("+")) {
			for(int i = 0; i < n; i++) {
				for(int j = 0; j < m; j++) {
					System.out.print((long)a[i]+b[j]+" ");
				}
				System.out.println();
			}
			
			
		}else {
			for(int i = 0; i < n; i++) {
				for(int j = 0; j < m; j++) {
					System.out.print((long)a[i]*b[j]+" ");
				}
				System.out.println();
			}
		
		}
		
	}

}
0