結果

問題 No.987 N×Mマス計算(基本)
ユーザー rymg111
提出日時 2020-09-22 21:43:33
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 761 bytes
コンパイル時間 1,998 ms
コンパイル使用メモリ 76,808 KB
実行使用メモリ 44,552 KB
最終ジャッジ日時 2024-06-26 21:19:21
合計ジャッジ時間 7,321 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int raws = sc.nextInt();
		int columns = sc.nextInt();
		String op = sc.next();
		int[] rawNum = new int[raws];
		int[] colNum = new int[columns];
		for(int i = 0; i < columns; i++) {
			colNum[i] = sc.nextInt();
		}
		for(int j = 0; j < raws; j++) {
			rawNum[j] = sc.nextInt();
		}
		for(int k = 0; k < raws; k++) {
			for(int l = 0; l < columns; l++) {
				calculate(op, rawNum[k], colNum[l]);
				System.out.print(" ");
			}
			System.out.println("");
		}
	}
	public static void calculate(String op, int raw, int col) {
		if(op.equals("*")) {
			System.out.print(raw * col);
		} else {
			System.out.print(raw + col);
		}
	}
}
0