結果

問題 No.680 作れる数
ユーザー hang_hang_cln
提出日時 2018-05-07 20:38:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 542 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 17,280 KB
最終ジャッジ日時 2024-06-28 02:19:43
合計ジャッジ時間 4,463 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 7 TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

# 1
s = 0
t = 0

NEXTqueue = [(0,0)] # 計算待ちキュー

can = False
while True:
    if len(NEXTqueue) == 0:
        break
    s,t = NEXTqueue.pop(0)
    # 2
    t *= 2
    
    # 3
    
    # 4
    #s += t
    if s+t == N or s+t+1 == N:
        can = True
        break
    if (s+t,t) not in NEXTqueue:        
        NEXTqueue.append((s+t, t))
    if (s+t+1, t+1) not in NEXTqueue:
        NEXTqueue.append((s+t+1, t+1))
    if NEXTqueue[-1][0] > N:
        break

if can:
    print('Yes')
else:
    print('No')
    
0