結果

問題 No.3108 Luke or Bishop
コンテスト
ユーザー aaaaaaaaaaa
提出日時 2025-04-18 21:19:13
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 0 ms / 2,000 ms
コード長 455 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 405 ms
コンパイル使用メモリ 94,388 KB
実行使用メモリ 5,632 KB
最終ジャッジ日時 2026-07-09 18:41:16
合計ジャッジ時間 1,675 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <cmath> // for std::abs

int main() {
    long long gx, gy; // 使用 long long 来存储 G_x 和 G_y
    std::cin >> gx >> gy;

    if (gx == 0 && gy == 0) {
        std::cout << 0 << std::endl;
    } else if (gx == 0 || gy == 0) {
        std::cout << 1 << std::endl;
    } else if (std::abs(gx) == std::abs(gy)) {
        std::cout << 1 << std::endl;
    } else {
        std::cout << 2 << std::endl;
    }

    return 0;
}
0