結果
| 問題 | 
                            No.84 悪の算盤
                             | 
                    
| コンテスト | |
| ユーザー | 
                             koyumeishi
                         | 
                    
| 提出日時 | 2014-12-03 22:58:31 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 489 bytes | 
| コンパイル時間 | 599 ms | 
| コンパイル使用メモリ | 72,088 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-13 08:44:20 | 
| 合計ジャッジ時間 | 1,134 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 10 | 
ソースコード
#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std;
int main(){
	long long r,c;
	cin >> r >> c;
	long long ans;
	if(r==c){
		if(r%2 == 1){
			ans = (r*c-1)/4 + 1;
		}else{
			ans = (r*c)/4;
		}
	}else{
		if(r%2 == 1 && c%2 == 1){
			ans = (r*c-1)/2 + 1;
		}else{
			ans = r*c/2;
		}
	}
	cout << ans-1 << endl;
	return 0;
}
            
            
            
        
            
koyumeishi