結果

問題 No.84 悪の算盤
ユーザー scache
提出日時 2014-12-03 00:14:04
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 3,336 ms
コンパイル使用メモリ 75,184 KB
実行使用メモリ 41,464 KB
最終ジャッジ日時 2024-06-11 07:54:52
合計ジャッジ時間 5,776 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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