結果
| 問題 | No.3 ビットすごろく |
| コンテスト | |
| ユーザー |
kpinkcat
|
| 提出日時 | 2022-10-13 13:50:21 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 692 bytes |
| コンパイル時間 | 191 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-06-26 12:01:50 |
| 合計ジャッジ時間 | 2,447 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 15 |
ソースコード
N = int(input())
now = 1
line = []
trace = []
for i in range(1, N+1):
b_num = '{0:b}'.format(i)
c = 0
for j in b_num:
if j == "1":
c += 1
line.append(c)
#print(c, b_num)
c = 1
while 1 :
if now == N:
print(c)
#print(trace)
break
else:
c += 1
if line[now -1] + now > N:
if now - line[now -1] <= 0:
print(-1)
else:
now -= line[now -1]
if str(now) in trace:
print(-1)
break
else:
trace.append(str(now))
#print(trace)
now += line[now -1]
kpinkcat