結果

問題 No.3 ビットすごろく
ユーザー StarMatyanStarMatyan
提出日時 2018-07-22 01:47:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 632 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 7,992 KB
最終ジャッジ日時 2023-08-27 00:49:18
合計ジャッジ時間 6,949 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,992 KB
testcase_01 AC 18 ms
7,720 KB
testcase_02 AC 17 ms
7,836 KB
testcase_03 AC 18 ms
7,856 KB
testcase_04 AC 16 ms
7,800 KB
testcase_05 AC 20 ms
7,836 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

targetN = int(input());
kakunin = 1;
result = 1;
moji = "";
mathu = 0;
tyokau = 0;
tmpnum = 0;
tmpcounter = 0;

while targetN != kakunin and result != -1:
	mathu = 0;
	data = kakunin;
	while data >= 1:
		if data % 2 == 1:
			mathu = mathu + 1;
		
		data = int(data/2);
		
	
	if targetN > 1:
	    kakunin = kakunin + mathu;

	if targetN > kakunin or targetN == kakunin:
		result = result + 1;
	else:
		kakunin = kakunin - 2 * mathu;
		if tmpcounter == 0:
		    tmpnum = kakunin;
		    tmpcounter= tmpcounter+1;
		result = result + 1;
		tyokau = tyokau + 1;
		if tyokau > 1 and tmpnum ==kakunin:
			result = -1;
			
	

print(result);
0