結果

問題 No.84 悪の算盤
ユーザー soujikisoujiki
提出日時 2015-04-29 21:08:28
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 4,077 ms
コンパイル使用メモリ 72,252 KB
実行使用メモリ 56,100 KB
最終ジャッジ日時 2023-09-19 04:13:07
合計ジャッジ時間 6,407 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
55,692 KB
testcase_01 AC 129 ms
55,928 KB
testcase_02 AC 130 ms
56,064 KB
testcase_03 AC 129 ms
55,812 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 128 ms
56,036 KB
testcase_08 AC 127 ms
55,436 KB
testcase_09 AC 132 ms
55,792 KB
testcase_10 AC 128 ms
55,940 KB
testcase_11 AC 129 ms
55,904 KB
testcase_12 AC 129 ms
55,572 KB
権限があれば一括ダウンロードができます

ソースコード

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