結果

問題 No.208 王将
ユーザー machy
提出日時 2015-06-13 11:46:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 450 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 66,400 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-09 16:25:23
合計ジャッジ時間 1,321 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long LL;

LL iabs(LL n){
    if(n < 0) return -n;
    return n;
}

int main(){
    int x, y, x2, y2;
    cin >> x >> y >> x2 >> y2;
    LL ans = 0;
    ans += max(iabs(x), iabs(y));
    if(iabs(x) == iabs(y) && iabs(x2) == iabs(y2) && iabs(x) > iabs(x2) && x/y == x2/y2){
        ans += 1;
    }
    cout << ans << endl;
    return 0;
}
0