結果

問題 No.3108 Luke or Bishop
ユーザー 李金江
提出日時 2025-04-18 21:31:47
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 514 bytes
コンパイル時間 840 ms
コンパイル使用メモリ 76,992 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-18 21:31:49
合計ジャッジ時間 1,596 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
using namespace std;

int main() {
    long long Gx, Gy;
    cin >> Gx >> Gy;

    // 特殊情况:目标点是原点
    if (Gx == 0 && Gy == 0) {
        cout << 0 << endl;
        return 0;
    }

    // 检查是否可以使用象(Bishop)一步到达
    if (abs(Gx) == abs(Gy) || (Gx * Gy > 0 && abs(Gx) == abs(Gy))) {
        cout << 1 << endl;
    } else {
        // 否则使用车(Rook),最多需要两步
        cout << 2 << endl;
    }

    return 0;
}
0