結果

問題 No.294 SuperFizzBuzz
ユーザー fmhrfmhr
提出日時 2015-10-25 17:23:18
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,227 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 148,752 KB
最終ジャッジ日時 2023-10-11 09:39:56
合計ジャッジ時間 6,944 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
148,752 KB
testcase_01 AC 65 ms
71,456 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 #

# coding:utf-8

import sys
# from itertools import product

#
#
#ume = [0, 0, 1, 3, 6, 11, 21, 42, 85, 171, 342, 683, 1365, 2730, 5461, 10923, 21846, 43691, 87381, 174762, 349525,
#	   699051, 1398102, 2796203, 5592405, 10000001]


def popcount(x):
	return bin(x).count("1")


# if N in ume:
#     print(ume.index(N))
#     sys.exit()
# else:
def solve():
	N = int(input())
	count = 0
#	ume_i = [0]*10000000
#	ume_j = [0]*10000000
#	for u in range(len(ume)):
#		if N==ume[u]:
#			i = u+1
#			count = ume[u-1]
#			break
#		elif N<ume[u]:
#			i = u
#			count = ume[u]
#			break
#			# else:
			#     i = 24
			#     count = ume[-1]

	# print('i', i, count)
	x = 0
	for i in range(1,26):
		for j in range(10000000000000):
			a = bin(j)[2:]
			if len(a)>i:
				break
#			a = '0'*(i-len(a))+a
#			n = a.replace('0', '3').replace('1', '5')
#			x = ''.join(n)
#			x = int(x)
#			print(i,a,x)
#			if x%3==0 and x%5==0:
			if popcount(j)%3==0 and popcount(j)>=3 and a[-1]=='1':
				count += 1
#				ume_i[count]=i
#				ume_j[count]=j
				if count==N:
					a = '0'*(i-len(a))+a
					n = a.replace('0', '3').replace('1', '5')
					x = ''.join(n)
					x = int(x)
					print(x)
#					print(ume_i)
#					print(ume_j)
					sys.exit()


solve()
0