結果
問題 | No.84 悪の算盤 |
ユーザー |
![]() |
提出日時 | 2016-01-17 22:15:30 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 55 ms / 5,000 ms |
コード長 | 861 bytes |
コンパイル時間 | 1,978 ms |
コンパイル使用メモリ | 75,148 KB |
実行使用メモリ | 37,244 KB |
最終ジャッジ日時 | 2024-10-13 08:57:22 |
合計ジャッジ時間 | 3,662 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
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));elseout(f1 == 0 ? rc.divide(two).subtract(one) : rc.subtract(one).divide(two));}}