結果

問題 No.1809 Divide NCK
ユーザー MasKoaTS
提出日時 2021-09-20 13:16:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 336 bytes
コンパイル時間 756 ms
コンパイル使用メモリ 65,792 KB
最終ジャッジ日時 2025-01-24 16:01:34
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 4 WA * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
using ll = long long;

int main(void) {
	ll N, K;	cin >> N >> K;

	int ans = 0;
	int c = 0;
	ll R = N - K;

	while (R || K) {
		int a = R & 1;
		int b = K & 1;
		if (a + b + c >= 2) {
			ans += 1;
			c = 1;
		}
		else {
			c = 0;
		}
		R >>= 1;
		K >>= 1;
	}

	cout << ans << endl;
	return 0;
}
0