結果
問題 | No.84 悪の算盤 |
ユーザー |
![]() |
提出日時 | 2016-10-25 22:25:56 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 122 ms / 5,000 ms |
コード長 | 638 bytes |
コンパイル時間 | 1,959 ms |
コンパイル使用メモリ | 75,148 KB |
実行使用メモリ | 41,416 KB |
最終ジャッジ日時 | 2024-10-13 08:59:10 |
合計ジャッジ時間 | 4,121 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
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);}}