結果

問題 No.262 面白くないビットすごろく
ユーザー FF256grhyFF256grhy
提出日時 2015-08-01 00:07:21
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 292 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 25,548 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-24 23:52:38
合計ジャッジ時間 3,621 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,760 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// 絶対TLEする

#include <stdio.h>

int bc(long long int a) {
	int c = 0;
	while(a) {
		c += a % 2;
		a /= 2;
	}
	return c;
}

int main(void) {
	long long int n, p = 1, c = 1;
	scanf("%lld", &n);
	while(p < n) {
		p += bc(p);
		c++;
	}
	printf("%lld\n", (p == n) ? c : -1 );
	return 0;
}
0