結果

問題 No.84 悪の算盤
ユーザー alpha_virginis
提出日時 2015-05-24 22:42:17
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 468 bytes
コンパイル時間 1,131 ms
コンパイル使用メモリ 159,436 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-13 08:52:22
合計ジャッジ時間 1,761 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

inline long nextInt(void) {
  long temp;
  std::cin >> temp;
  return temp;
}

int main() {

  long R, C;
  long ans;

  std::cin >> R >> C;

  if( R == C ) {
    if( R % 2 == 0 ) {
      ans = R * C / 4;
    }
    else {
      ans = (R * C - 1) / 4 + 1;
    }
  }
  else {
    if( (R * C) % 2 == 0 ) {
      ans = R * C / 2;
    }
    else {
      ans = (R * C - 1) / 2 + 1;
    }
  }

  std::cout << ans - 1 << std::endl;
  
  return 0;
}

0