結果

問題 No.294 SuperFizzBuzz
ユーザー cielciel
提出日時 2015-10-24 00:49:08
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 752 bytes
コンパイル時間 715 ms
コンパイル使用メモリ 6,560 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2023-10-11 05:13:48
合計ジャッジ時間 7,384 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
5,968 KB
testcase_01 AC 14 ms
6,024 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

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