結果

問題 No.84 悪の算盤
ユーザー YamaKasaYamaKasa
提出日時 2018-07-03 22:58:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 479 bytes
コンパイル時間 1,899 ms
コンパイル使用メモリ 70,788 KB
実行使用メモリ 56,740 KB
最終ジャッジ日時 2023-09-13 17:20:57
合計ジャッジ時間 4,215 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,796 KB
testcase_01 AC 119 ms
55,908 KB
testcase_02 AC 118 ms
55,576 KB
testcase_03 AC 118 ms
56,292 KB
testcase_04 AC 118 ms
55,956 KB
testcase_05 AC 119 ms
55,556 KB
testcase_06 AC 119 ms
55,356 KB
testcase_07 AC 118 ms
55,784 KB
testcase_08 AC 119 ms
55,560 KB
testcase_09 AC 119 ms
55,960 KB
testcase_10 AC 118 ms
55,856 KB
testcase_11 AC 120 ms
56,740 KB
testcase_12 AC 118 ms
56,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long R = scan.nextLong();
		long C = scan.nextLong();
		scan.close();
		if(R != C) {
			if(R % 2 == 1 && C % 2 == 1) {
				System.out.println((R * C) / 2);
			}else {
				System.out.println((R * C - 1) / 2);
			}
		}else {
			if(R % 2 == 0) {
				System.out.println(R * C / 4 - 1);
			}else {
				System.out.println((R * C - 1) / 4);
			}
		}
	}
}
0