結果

問題 No.1809 Divide NCK
ユーザー MasKoaTS
提出日時 2021-09-19 23:01:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 292 bytes
コンパイル時間 859 ms
コンパイル使用メモリ 66,916 KB
最終ジャッジ日時 2025-01-24 15:56:23
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 1 WA * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

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


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

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

	while (N) {
		N >>= 1;
		ans += N;
	}

	while (K) {
		K >>= 1;
		ans -= K;
	}

	while (R) {
		R >>= 1;
		ans -= 1;
	}

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