結果
| 問題 |
No.208 王将
|
| コンテスト | |
| ユーザー |
hanorver
|
| 提出日時 | 2015-10-16 21:13:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 445 bytes |
| コンパイル時間 | 582 ms |
| コンパイル使用メモリ | 58,076 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-21 18:29:35 |
| 合計ジャッジ時間 | 1,746 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 WA * 14 |
ソースコード
#include<iostream>
#include<algorithm>
int main() {
int gx, gy, ex, ey;
std::cin >> gx >> gy >> ex >> ey;
int ans = 0;
if (ex == ey)ans += 2;
if (gx > gy) {
gx -= gy;
ex -= gy;
ey -= gy;
ans += gy;
gy = 0;
} else {
gy -= gx;
ey -= gx;
ex -= gx;
ans += gx;
gx = 0;
}
ans += std::max(gx, gy);
if (ey < 0 || ex < 0) {
std::cout << ans << std::endl;
return 0;
}
std::cout << ans + 2 << std::endl;
return 0;
}
hanorver