結果

問題 No.987 N×Mマス計算(基本)
ユーザー ParSAParSA
提出日時 2020-02-14 21:57:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 331 ms / 2,000 ms
コード長 769 bytes
コンパイル時間 2,323 ms
コンパイル使用メモリ 79,696 KB
実行使用メモリ 43,996 KB
最終ジャッジ日時 2024-04-16 01:57:46
合計ジャッジ時間 7,899 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 155 ms
41,696 KB
testcase_01 AC 152 ms
41,420 KB
testcase_02 AC 279 ms
43,224 KB
testcase_03 AC 222 ms
42,360 KB
testcase_04 AC 244 ms
42,720 KB
testcase_05 AC 243 ms
42,744 KB
testcase_06 AC 256 ms
43,208 KB
testcase_07 AC 223 ms
42,664 KB
testcase_08 AC 178 ms
42,180 KB
testcase_09 AC 163 ms
40,856 KB
testcase_10 AC 184 ms
42,036 KB
testcase_11 AC 264 ms
43,120 KB
testcase_12 AC 291 ms
43,228 KB
testcase_13 AC 229 ms
42,532 KB
testcase_14 AC 176 ms
42,084 KB
testcase_15 AC 228 ms
42,548 KB
testcase_16 AC 306 ms
43,132 KB
testcase_17 AC 254 ms
42,892 KB
testcase_18 AC 308 ms
43,352 KB
testcase_19 AC 331 ms
43,996 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