結果
問題 |
No.208 王将
|
ユーザー |
|
提出日時 | 2015-09-20 22:13:24 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 797 bytes |
コンパイル時間 | 544 ms |
コンパイル使用メモリ | 57,688 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-09 16:27:27 |
合計ジャッジ時間 | 1,200 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
#include <iostream> using namespace std; #include <cstdio> #include <string.h> #include <stdlib.h> #include <math.h> #define FOR(i,a,b) for(int (i)=(a);i<(b);i++) typedef long long ll; typedef unsigned long long ull; typedef long double lb; /* ここからが本編 */ int main(void) { int i,j,k,l; int x,y; int x2,y2; int ans; cin >> x >> y; cin >> x2 >> y2; if(x * x2 < 0) { x2 = -1; y2 = -1; } else if( y * y2 < 0) { x2 = -1; y2 = -1; } x = abs(x); y = abs(y); if(x > y) ans = x; else if(x < y) ans = y; /* こっからはx == yの条件が自然につく */ else if(x > 1) { ans = x; if(x2 == y2 && 0 < x2 && x2 < x) ans += 1; } else if(x == 1) ans = 1; printf("%d\n",ans); return 0; }