結果

問題 No.84 悪の算盤
ユーザー scachescache
提出日時 2014-12-03 00:14:04
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 3,238 ms
コンパイル使用メモリ 71,808 KB
実行使用メモリ 56,100 KB
最終ジャッジ日時 2023-09-02 01:18:17
合計ジャッジ時間 5,681 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
56,084 KB
testcase_01 AC 122 ms
55,672 KB
testcase_02 AC 123 ms
56,004 KB
testcase_03 AC 124 ms
55,592 KB
testcase_04 AC 123 ms
55,676 KB
testcase_05 AC 122 ms
55,756 KB
testcase_06 WA -
testcase_07 AC 120 ms
55,564 KB
testcase_08 AC 122 ms
55,968 KB
testcase_09 AC 122 ms
55,848 KB
testcase_10 AC 122 ms
56,100 KB
testcase_11 AC 124 ms
56,004 KB
testcase_12 AC 122 ms
55,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main84 {
	public static void main(String[] args) {
		Main84 p = new Main84();
	}

	public Main84() {
		Scanner sc = new Scanner(System.in);
		long R = sc.nextLong();
		long C = sc.nextLong();
		solve(R, C);
	}

	public void solve(long r, long c) {
		
		long res = -1;
		if(r==1 || c==1)
			res += (r*c+1)/2;
		else if(r==c)
			res += (r*c-r-c+1)/4+(r+1)/2 + r%2;
		else
			res += r*(c/2) + (r+1)/2 * (c%2);
		
		System.out.println(res);
	}

}
0