結果

問題 No.84 悪の算盤
ユーザー atkrymatkrym
提出日時 2016-10-25 22:25:56
言語 Java19
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 638 bytes
コンパイル時間 2,117 ms
コンパイル使用メモリ 71,324 KB
実行使用メモリ 56,148 KB
最終ジャッジ日時 2023-08-03 12:16:22
合計ジャッジ時間 4,336 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,516 KB
testcase_01 AC 123 ms
55,932 KB
testcase_02 AC 129 ms
55,376 KB
testcase_03 AC 127 ms
55,552 KB
testcase_04 AC 123 ms
56,088 KB
testcase_05 AC 122 ms
56,148 KB
testcase_06 AC 122 ms
54,696 KB
testcase_07 AC 121 ms
55,836 KB
testcase_08 AC 122 ms
55,648 KB
testcase_09 AC 124 ms
55,844 KB
testcase_10 AC 122 ms
55,924 KB
testcase_11 AC 121 ms
56,084 KB
testcase_12 AC 122 ms
55,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        long r = sc.nextLong();
        long c = sc.nextLong();
        long ret;
        boolean b = r%2==0 || c%2==0;
        if (r == c) {
            if (b) {
                ret = r*c/4-1;
            } else {
                ret = (r*c-1)/4;
            }
        } else {
            if (b) {
                ret = r*c/2-1;
            } else {
                ret = (r*c-1)/2;
            }
        }
        
        System.out.println(ret);
    }
}
0