結果

問題 No.987 N×Mマス計算(基本)
ユーザー ParSA
提出日時 2020-02-14 21:49:57
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 763 bytes
コンパイル時間 2,905 ms
コンパイル使用メモリ 79,156 KB
実行使用メモリ 43,952 KB
最終ジャッジ日時 2024-10-06 11:19:24
合計ジャッジ時間 8,058 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13 WA * 5
権限があれば一括ダウンロードができます

ソースコード

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++) {
					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++) {
					System.out.print(a[i]*b[j]+" ");
				}
				System.out.println();
			}
		
		}
		
	}

}
0