結果

問題 No.84 悪の算盤
ユーザー Grenache
提出日時 2015-11-06 21:59:47
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 536 bytes
コンパイル時間 3,579 ms
コンパイル使用メモリ 74,088 KB
実行使用メモリ 41,324 KB
最終ジャッジ日時 2024-10-13 08:56:37
合計ジャッジ時間 5,783 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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