結果

問題 No.84 悪の算盤
ユーザー GrenacheGrenache
提出日時 2015-11-06 21:59:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 5,000 ms
コード長 536 bytes
コンパイル時間 3,008 ms
コンパイル使用メモリ 74,568 KB
実行使用メモリ 54,368 KB
最終ジャッジ日時 2024-04-21 10:09:12
合計ジャッジ時間 5,134 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
54,168 KB
testcase_01 AC 113 ms
53,660 KB
testcase_02 AC 104 ms
52,836 KB
testcase_03 AC 108 ms
53,340 KB
testcase_04 AC 101 ms
53,024 KB
testcase_05 AC 110 ms
53,892 KB
testcase_06 AC 114 ms
53,932 KB
testcase_07 AC 115 ms
54,156 KB
testcase_08 AC 121 ms
54,368 KB
testcase_09 AC 101 ms
53,104 KB
testcase_10 AC 98 ms
52,852 KB
testcase_11 AC 116 ms
54,092 KB
testcase_12 AC 111 ms
54,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder84 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long r = sc.nextInt();
        long c = sc.nextInt();

        long ret = (r / 2) * (c / 2);
        if (r != c) {
        	ret *= 2;
        }
        ret += (r % 2) * (c / 2);
        if (r != c) {
        	ret += (c % 2) * (r / 2);
        }
        if ((r % 2) * (c % 2) != 0) {
        	ret++;
        }

        System.out.println(ret - 1);

        sc.close();
    }
}
0