結果

問題 No.987 N×Mマス計算(基本)
ユーザー ParSAParSA
提出日時 2020-02-14 21:55:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 923 bytes
コンパイル時間 2,794 ms
コンパイル使用メモリ 79,756 KB
実行使用メモリ 44,808 KB
最終ジャッジ日時 2024-04-16 01:54:38
合計ジャッジ時間 8,270 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
41,612 KB
testcase_01 AC 145 ms
41,844 KB
testcase_02 AC 266 ms
43,084 KB
testcase_03 AC 217 ms
42,348 KB
testcase_04 AC 236 ms
42,700 KB
testcase_05 AC 232 ms
42,612 KB
testcase_06 AC 244 ms
42,792 KB
testcase_07 AC 225 ms
42,656 KB
testcase_08 AC 156 ms
40,992 KB
testcase_09 AC 158 ms
40,888 KB
testcase_10 WA -
testcase_11 AC 260 ms
43,172 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 181 ms
41,852 KB
testcase_15 AC 235 ms
42,252 KB
testcase_16 AC 300 ms
43,244 KB
testcase_17 WA -
testcase_18 AC 290 ms
43,560 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
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++) {
					if(j==m-1) {
						System.out.print(a[i]+b[j]);
					}else {
						
					System.out.print(a[i]+b[j]+" ");
					}
				}
				System.out.println();
			}
			
			
		}else {
			for(int i = 0; i < n; i++) {
				for(int j = 0; j < m; j++) {
					if(j==m-1) {
						System.out.print(a[i]*b[j]);
					}else {
						
					System.out.print(a[i]*b[j]+" ");
					}
				}
				System.out.println();
			}
		
		}
		
	}

}
0