結果

問題 No.208 王将
ユーザー cormoran
提出日時 2016-11-08 17:25:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 543 bytes
コンパイル時間 1,270 ms
コンパイル使用メモリ 158,720 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-25 04:53:16
合計ジャッジ時間 2,060 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
class Solver {
  public:
    bool solve() {
        int x, y; cin >> x >> y;
        int xe, ye; cin >> xe >> ye;
        int ans = max(abs(x), abs(y));

        if(abs(x) == abs(y) and abs(xe) == abs(ye)) {
            if(x * xe >= 0 and y * ye >= 0) {
                if(abs(x) > abs(xe)) ans += 1;
            }
        }
        
        cout << ans << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}
0