結果

問題 No.84 悪の算盤
ユーザー YamaKasaYamaKasa
提出日時 2018-07-03 22:40:02
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 488 bytes
コンパイル時間 1,886 ms
コンパイル使用メモリ 71,368 KB
実行使用メモリ 58,188 KB
最終ジャッジ日時 2023-09-13 17:20:15
合計ジャッジ時間 4,227 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
56,220 KB
testcase_01 AC 118 ms
55,520 KB
testcase_02 AC 122 ms
55,156 KB
testcase_03 AC 118 ms
53,836 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 120 ms
56,020 KB
testcase_08 AC 122 ms
56,296 KB
testcase_09 AC 120 ms
55,876 KB
testcase_10 AC 119 ms
56,192 KB
testcase_11 AC 119 ms
56,356 KB
testcase_12 AC 118 ms
56,080 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 == 1 && C == 1) {
			System.out.println(0);
			System.exit(0);
		}
		if(R % 2 == 1 && C % 2 ==1) {
			System.out.println(R * (C / 2) + R / 2);
		}else {
			if(R % 2 == 0) {
				System.out.println((R / 2) * C - 1);
			}else{
				System.out.println(R  * (C / 2) - 1);
			}
		}
	}
}
0