結果

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

ソースコード

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+(C-1)/2+(R-1)/2;
				}
			}
			System.out.println(ans);
		}
	}
}
0