結果

問題 No.208 王将
コンテスト
ユーザー yuppe19 😺
提出日時 2015-05-15 22:50:29
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 500 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 180 ms
コンパイル使用メモリ 51,092 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2026-03-27 14:42:14
合計ジャッジ時間 876 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <cstdio>
#include <algorithm>
using namespace std;

int main(void) {
  int x, y, x2, y2;
  int res;
  scanf("%d%d%d%d", &x, &y, &x2, &y2);
  if(y==0 && y2==0) { res = abs(x) + 1; }
  else if(x==0 && x2==0) { res = abs(y) + 1; }
//  else if(x==0 || x2==0 || y==0||y2==0) { res=max(abs(x), abs(y)); }
  else if(x==y && x2==y2 && x*x2>0) { res = abs(x) + 4; }
  else if(x==-y && x2==-y2 && x*x2>0) { res = abs(x) + 4; }
  else { res = max(abs(x), abs(y)); }
  printf("%d\n", res);
  return 0;
}
0