結果

問題 No.3108 Luke or Bishop
ユーザー elphe
提出日時 2025-05-17 11:32:36
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 1,043 ms
コンパイル使用メモリ 94,768 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-17 11:32:38
合計ジャッジ時間 2,498 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdint>
#include <cmath>

using namespace std;

static inline constexpr uint32_t solve(const int32_t G_x, const int32_t G_y) noexcept
{
	if (G_x == 0)
	{
		if (G_y == 0)
			return 0;
		else
			return 1;
	}
	else if (G_y == 0)
		return 1;
	else if (abs(G_x) == abs(G_y))
		return 1;
	else
		return 2;
}

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	
	int32_t G_x, G_y;
	cin >> G_x >> G_y;

	cout << solve(G_x, G_y) << '\n';
	return 0;
}
0