結果

問題 No.84 悪の算盤
コンテスト
ユーザー nanasili
提出日時 2014-12-02 23:56:28
言語 C++11(廃止可能性あり)
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 746 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 748 ms
コンパイル使用メモリ 104,676 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-04 10:09:10
合計ジャッジ時間 1,017 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <algorithm>
#include <climits>
#include <cstdlib>
#include <vector>
#include <cctype>
#include <deque>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <ctime>
#include <stack>
#include <cstdio>
#include <string>
#include <iomanip>
#include <cstring>
#include <iostream>
#include <functional>

using namespace std;

typedef long long ll;


#define LLMAX LLONG_MAX
#define IMAX INT_MAX


int main() {
  ll r, c;
  cin >> r >> c;
  if (r != c) {
    if ((r*c)%2) {
      cout << r*(c/2)+(r+1)/2-1 << endl;
    }else {
      cout << (r*c)/2-1 << endl;
    }
  }else {
    if (r%2) {
      cout << 1+r*(r-1)-1 << endl;
    }else {
      cout << r*r-1 << endl;
    }
  }
}
0