結果

問題 No.294 SuperFizzBuzz
ユーザー cielciel
提出日時 2015-10-24 00:43:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 184 ms / 5,000 ms
コード長 752 bytes
コンパイル時間 482 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 76,640 KB
最終ジャッジ日時 2023-10-11 05:12:06
合計ジャッジ時間 3,055 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,464 KB
testcase_01 AC 73 ms
70,996 KB
testcase_02 AC 184 ms
76,520 KB
testcase_03 AC 73 ms
71,236 KB
testcase_04 AC 73 ms
71,192 KB
testcase_05 AC 73 ms
71,260 KB
testcase_06 AC 75 ms
71,312 KB
testcase_07 AC 81 ms
76,060 KB
testcase_08 AC 85 ms
76,208 KB
testcase_09 AC 145 ms
76,568 KB
testcase_10 AC 73 ms
71,168 KB
testcase_11 AC 164 ms
76,520 KB
testcase_12 AC 172 ms
76,640 KB
testcase_13 AC 179 ms
76,444 KB
testcase_14 AC 182 ms
76,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
def comb(n,r):
	if r==0: return 1
	ret=1
	if r>n//2: r=n-r
	for i in range(r):
		ret=ret*(n-i)/(i+1)
	return ret

def popcnt32(n):
	m1=0x55555555
	m2=0x33333333
	m4=0x0f0f0f0f
	m8=0x00ff00ff
	m16=0x0000ffff
	n=((n>>1)&m1)+(n&m1)
	n=((n>>2)&m2)+(n&m2)
	n=((n>>4)&m4)+(n&m4)
	n=((n>>8)&m8)+(n&m8)
	n=((n>>16)&m16)+(n&m16)
	return n

if 'maketrans' in str.__dict__:
	maketrans=str.maketrans
	raw_input=input
else:
	from string import maketrans

n=int(raw_input())
digits=2
while True:
	s=0
	five=2
	while five<=digits:
		s+=comb(digits,five)
		five+=3
	if n<=s: break
	n-=s
	digits+=1

i=1
while True:
	if popcnt32(i)%3==2:
		n-=1
		if n==0:
			print(('{:0'+str(digits)+'b}').format(i).translate(maketrans('01','35'))+'5')
			break
	i+=1
0