結果

問題 No.378 名声値を稼ごう
ユーザー umaumax
提出日時 2017-05-01 21:05:56
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 54,480 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 01:11:28
合計ジャッジ時間 709 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main(int argc, const char* argv[])
{
	size_t N;
	cin >> N;
	size_t normal = 0;
	size_t ideal  = 0;
	size_t tmp	= N;
	while (tmp > 0) {
		if (ideal < normal + tmp * 2) {
			ideal = normal + tmp * 2;
		}
		normal += tmp;
		tmp >>= 1;
	}
	cout << ideal - normal << endl;
	return 0;
}
0