結果

問題 No.84 悪の算盤
ユーザー tsunabittsunabit
提出日時 2020-01-09 11:23:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 140 ms / 5,000 ms
コード長 478 bytes
コンパイル時間 3,420 ms
コンパイル使用メモリ 75,508 KB
実行使用メモリ 41,440 KB
最終ジャッジ日時 2024-05-02 13:37:38
合計ジャッジ時間 5,880 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
41,100 KB
testcase_01 AC 134 ms
40,944 KB
testcase_02 AC 132 ms
40,984 KB
testcase_03 AC 131 ms
41,016 KB
testcase_04 AC 129 ms
41,096 KB
testcase_05 AC 140 ms
41,140 KB
testcase_06 AC 136 ms
40,968 KB
testcase_07 AC 132 ms
40,940 KB
testcase_08 AC 135 ms
41,356 KB
testcase_09 AC 135 ms
41,196 KB
testcase_10 AC 130 ms
41,120 KB
testcase_11 AC 133 ms
41,440 KB
testcase_12 AC 120 ms
40,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No84 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long r = sc.nextLong();
		long c = sc.nextLong();
		long a = 0;
		
		if(r == c) {
			if(r % 2 == 0) {
				a = (long)(r * c / 4 - 1);
			}else {
				a = (long)(r * c / 4);
			}
		}
		else if(r * c % 2 == 0) a = (long)(r * c / 2 - 1);
		else a = (long)(r * c / 2);		
		
		if(a < 0) a = 0;
		System.out.println(a);
	}
}
0