結果

問題 No.84 悪の算盤
ユーザー tsunabit
提出日時 2020-01-09 11:23:34
言語 Java
(openjdk 23)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 478 bytes
コンパイル時間 3,268 ms
コンパイル使用メモリ 74,112 KB
実行使用メモリ 54,556 KB
最終ジャッジ日時 2024-11-23 03:44:41
合計ジャッジ時間 5,690 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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