結果

問題 No.208 王将
ユーザー h_noson
提出日時 2016-02-16 23:56:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 611 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 59,764 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 07:21:40
合計ジャッジ時間 1,232 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define RREP(i,s,e) for (int i = e-1; i >= s; i--)
#define rrep(i,n) RREP(i,0,n)
#define REP(i,s,e) for (int i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)

int main() {
    int x1, y1, x2, y2, ans;
    cin >> x1 >> y1 >> x2 >> y2;
    ans = max(abs(x1),abs(y1));
    if (x1 == 0 && x2 == 0 && abs(y1) < abs(y2) || y1 == 0 && y2 == 0 && abs(x1) < abs(x2))
        ans++;
    else if (abs(x1) == abs(y1) && abs(x2) == abs(y2) && abs(x1) < abs(x2) && x1*x2 > 0 && y1*y2 > 0)
        ans++;
    cout << ans << endl;
    return 0;
}

0