結果

問題 No.3108 Luke or Bishop
ユーザー kkk
提出日時 2025-04-18 21:40:55
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 809 bytes
コンパイル時間 3,588 ms
コンパイル使用メモリ 250,220 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-18 21:41:00
合計ジャッジ時間 4,699 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>

using namespace atcoder;
using namespace std;
using ll = long long;
// --------------------------------------------------------
template <class T>
bool chmax(T &a, const T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#define FOR(i, l, r) for (ll i = (l); i < (r); ++i)
#define RFOR(i, l, r) for (ll i = (r) - 1; (l) <= i; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)

int main() {
  int a, b;
  cin >> a >> b;
  if (a == 0 && b == 0) {
    cout << 0 << endl;
  } else if (a == 0 || b == 0) {
    cout << 1 << endl;
  } else if (abs(a) == abs(b)) {
    cout << 1 << endl;
  } else {
    cout << 2 << endl;
  }
}
0