結果
問題 |
No.84 悪の算盤
|
ユーザー |
|
提出日時 | 2014-12-03 00:16:03 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 119 ms / 5,000 ms |
コード長 | 508 bytes |
コンパイル時間 | 2,980 ms |
コンパイル使用メモリ | 74,472 KB |
実行使用メモリ | 41,548 KB |
最終ジャッジ日時 | 2024-10-13 08:43:25 |
合計ジャッジ時間 | 5,147 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
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 ; else res += r*(c/2) + (r+1)/2 * (c%2); System.out.println(res); } }