結果

問題 No.3108 Luke or Bishop
ユーザー Kaki256
提出日時 2025-04-18 20:13:32
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,114 bytes
コンパイル時間 1,812 ms
コンパイル使用メモリ 193,036 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-04-18 20:13:34
合計ジャッジ時間 2,631 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

// MARK: - コード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

const ll MOD = 1000000007;
// const ll MOD = 998244353;
// using mint = modint998244353;
const int dx[8] = {0, -1, 1, 0, -1, 1, -1, 1};
const int dy[8] = {-1, 0, 0, 1, -1, -1, 1, 1};

template<class T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }

#define reps(i, l, r) for (std::decay_t<decltype(r)> i##_right = (r), i = (l); i < i##_right; i++)
#define rep(i, n) reps(i, 0, n)

template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}

int solve(int x, int y) {
    if (x == 0 && y == 0) return 0;
    
    if (x == 0 || y == 0) return 1;
    if (abs(x)==abs(y)) return 1;

    return 2;
}

int main() {
    int x, y;
    cin >> x >> y;
    cout << solve(x, y) << endl;
}
/*
MARK: - メモ



*/
0