結果

問題 No.84 悪の算盤
ユーザー spaciaspacia
提出日時 2016-01-17 22:15:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 72 ms / 5,000 ms
コード長 861 bytes
コンパイル時間 3,015 ms
コンパイル使用メモリ 75,084 KB
実行使用メモリ 50,324 KB
最終ジャッジ日時 2024-04-21 10:10:00
合計ジャッジ時間 4,579 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
50,264 KB
testcase_01 AC 70 ms
50,084 KB
testcase_02 AC 69 ms
50,016 KB
testcase_03 AC 71 ms
50,252 KB
testcase_04 AC 70 ms
49,932 KB
testcase_05 AC 70 ms
49,888 KB
testcase_06 AC 68 ms
49,960 KB
testcase_07 AC 69 ms
50,324 KB
testcase_08 AC 68 ms
50,252 KB
testcase_09 AC 70 ms
50,324 KB
testcase_10 AC 70 ms
50,224 KB
testcase_11 AC 72 ms
49,956 KB
testcase_12 AC 70 ms
50,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String[] line = br.readLine().split(" ");
		BigInteger r = new BigInteger(line[0]);
		BigInteger c = new BigInteger(line[1]);
		BigInteger rc = r.multiply(c);
		BigInteger one = BigInteger.ONE;
		BigInteger two = BigInteger.valueOf(2);
		BigInteger four = BigInteger.valueOf(4);
		
		int f0 = r.compareTo(c);
		int f1 = rc.remainder(BigInteger.valueOf(2)).compareTo(BigInteger.ZERO);
		
		if (f0 == 0)
			out(f1 == 0 ? rc.divide(four).subtract(one) : rc.subtract(one).divide(four));
		else
			out(f1 == 0 ? rc.divide(two).subtract(one) : rc.subtract(one).divide(two));
	}
}
0