結果

問題 No.84 悪の算盤
ユーザー soujikisoujiki
提出日時 2015-04-29 21:02:22
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 515 bytes
コンパイル時間 3,217 ms
コンパイル使用メモリ 72,124 KB
実行使用メモリ 57,816 KB
最終ジャッジ日時 2023-09-19 04:13:13
合計ジャッジ時間 5,760 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,944 KB
testcase_01 AC 126 ms
56,020 KB
testcase_02 AC 127 ms
55,960 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 129 ms
55,784 KB
testcase_08 WA -
testcase_09 AC 127 ms
56,004 KB
testcase_10 AC 130 ms
55,764 KB
testcase_11 AC 127 ms
55,448 KB
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

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