結果

問題 No.84 悪の算盤
ユーザー soujiki
提出日時 2015-04-29 21:02:22
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 515 bytes
コンパイル時間 3,112 ms
コンパイル使用メモリ 74,528 KB
実行使用メモリ 55,872 KB
最終ジャッジ日時 2024-07-05 16:48:13
合計ジャッジ時間 5,425 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 5 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

	
import java.util.*;

public class Yukicoder_84{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		long R = stdIn.nextLong();
		long C = stdIn.nextLong();
		long ans = 0;
		if(R==1 && C==1){
			System.out.println(0);
		}
		else{
			if(R%2==0){
				if(C%2==0){
					ans = R*C/2-1;
				}
				else{
					ans = (C-1)*R/2+R/2-1;
				}
			}
			else{
				if(C%2==0){
					ans = (R-1)*C/2+C/2-1;
				}
				else{
					ans = (R-1)*(C-1)/2-1;
				}
			}
			System.out.println(ans);
		}
	}
}
0