結果
| 問題 | 
                            No.84 悪の算盤
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-06-30 02:05:15 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 721 bytes | 
| コンパイル時間 | 1,977 ms | 
| コンパイル使用メモリ | 194,752 KB | 
| 実行使用メモリ | 7,844 KB | 
| 最終ジャッジ日時 | 2025-06-30 02:05:18 | 
| 合計ジャッジ時間 | 3,103 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 10 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
template<typename T>
istream &operator>>(istream &is,vector<T> &a){
    for(auto &v : a) cin >> v;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &a){
    if(a.size() == 0) return os;
    cout << a.at(0);
    for(int i=1; i<a.size(); i++) cout << " " << a.at(i);
    cout << "\n";
    return os;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    long long R,C; cin >> R >> C;
    if(C%2 == 0) swap(R,C);
    if(R == C){
        if(R%2) cout << (R-1)*(C-1)/4+R/2+1-1 << endl;
        else cout << R*C/4-1 << endl;
    }
    else if(R%2 == 0) cout << R*C/2-1 << endl;
    else cout << R*C/2 << endl;
    
}