結果

問題 No.84 悪の算盤
ユーザー recososo
提出日時 2020-02-13 10:51:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 577 bytes
コンパイル時間 1,475 ms
コンパイル使用メモリ 166,660 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-05 08:34:30
合計ジャッジ時間 2,023 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 7 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll r,c;cin >> r >> c;
    ll x,y,z;
    if(r%2==0&&c%2==0){
        x=0;
        y=0;
        z=(r/2)*(c/2);
        if(r!=c){
            z*=2;
        }
    }
    else if(r%2==1&&c%2==1){
        x=1;
        z=(r/2)*(c/2);
        if(r!=c){
            y=r/2+c/2;
            z*=2;
        }
        else{
            y=r/2;
        }
    }
    else{
        if(r%2==1){
            swap(r,c);
        }
        x=0;
        y=r/2;
        z=(r/2)*(c/2);
    }
    cout << x+y+z-1 << endl;
}
0