結果

問題 No.3276 Make Smaller Popcount
ユーザー akazuki8
提出日時 2025-09-19 21:38:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 801 ms / 2,000 ms
コード長 252 bytes
コンパイル時間 409 ms
コンパイル使用メモリ 82,640 KB
実行使用メモリ 77,484 KB
最終ジャッジ日時 2025-09-19 21:39:03
合計ジャッジ時間 22,430 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
	a=bin(int(input()))[2:]
	c=0
	ans=0
	for i in reversed(range(len(a))):
	    if a[i]=='1':
	        c+=1
	    if c==1:
	        ans+=pow(2,len(a)-1-i)
	    if c==2:
	        print(ans)
	        break 
	else:
	    print(-1)
0