結果

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

ソースコード

diff #

#include <iostream>
#include <cmath>

int main() {
    int Gx, Gy;
    std::cin >> Gx >> Gy;

    int rook_moves = 2;
    if (Gx == 0 || Gy == 0) {
        rook_moves = 1;
    }

    int bishop_moves = -1;
    if (Gx % 2 == Gy % 2) {
        if (Gx == 0 && Gy == 0) {
            bishop_moves = 0;
        }
        else {
            bishop_moves = 1;
        }
    }

    if (bishop_moves == -1) {
        std::cout << rook_moves << std::endl;
    }
    else {
        std::cout << std::min(rook_moves, bishop_moves) << std::endl;
    }

    return 0;
}
0