結果

問題 No.84 悪の算盤
ユーザー atkrymatkrym
提出日時 2016-10-25 22:25:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 638 bytes
コンパイル時間 2,186 ms
コンパイル使用メモリ 74,508 KB
実行使用メモリ 54,280 KB
最終ジャッジ日時 2024-04-21 10:12:07
合計ジャッジ時間 4,769 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
54,196 KB
testcase_01 AC 131 ms
54,236 KB
testcase_02 AC 131 ms
54,280 KB
testcase_03 AC 133 ms
54,164 KB
testcase_04 AC 131 ms
54,100 KB
testcase_05 AC 130 ms
53,884 KB
testcase_06 AC 130 ms
53,772 KB
testcase_07 AC 132 ms
54,068 KB
testcase_08 AC 132 ms
53,652 KB
testcase_09 AC 133 ms
54,028 KB
testcase_10 AC 133 ms
54,236 KB
testcase_11 AC 132 ms
54,000 KB
testcase_12 AC 131 ms
54,184 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