結果

問題 No.294 SuperFizzBuzz
ユーザー fmhrfmhr
提出日時 2015-10-25 18:40:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 785 ms / 5,000 ms
コード長 2,546 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 75,760 KB
最終ジャッジ日時 2024-09-13 09:02:28
合計ジャッジ時間 4,912 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
54,032 KB
testcase_01 AC 43 ms
54,320 KB
testcase_02 AC 40 ms
52,816 KB
testcase_03 AC 37 ms
53,276 KB
testcase_04 AC 38 ms
53,716 KB
testcase_05 AC 37 ms
52,952 KB
testcase_06 AC 57 ms
69,760 KB
testcase_07 AC 75 ms
75,760 KB
testcase_08 AC 407 ms
75,548 KB
testcase_09 AC 708 ms
75,492 KB
testcase_10 AC 711 ms
75,324 KB
testcase_11 AC 131 ms
75,600 KB
testcase_12 AC 436 ms
75,552 KB
testcase_13 AC 528 ms
75,700 KB
testcase_14 AC 785 ms
75,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding:utf-8

import sys

ume_i=[0, 19, 20, 20, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25]

ume_j=[0,75711, 151419, 751427, 302841, 902867, 1502853, 5699, 605701, 1205719, 1805703, 2405735, 3005701, 3605711, 11401, 611385, 1211401, 1811391, 2411421, 3011415, 3611383, 4211407, 4811419, 5411397, 6011395, 6611385, 7211393, 7811395, 22793, 622799, 1222795, 1822785, 2422789, 3022785, 3622775, 4222781, 4822807, 5422785, 6022785, 6622785, 7222771, 7822783, 8422785, 9022791, 9622769, 10222757, 10822781, 11422765, 12022781, 12622791, 13222757, 13822781, 14422783, 15022781, 15622793, 16222799, 45571, 645581, 1245591, 1845571, 2445581, 3045545, 3645561, 4245563, 4845567, 5445567, 6045557, 6645539, 7245557, 7845545, 8445561, 9045557, 9645563, 10245539, 10845557, 11445545, 12045553, 12645561, 13245557, 13845559, 14445575, 15045563, 15645565, 16245553, 16845567, 17445591, 18045541, 18645545, 19245537, 19845569, 20445563, 21045561, 21645557, 22245545, 22845567, 23445569, 24045561, 24645569, 25245579, 25845563, 26445559]


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


#def popcount(n):
#	n = (n & 0x5555555555555555) + ((n & 0xAAAAAAAAAAAAAAAA) >> 1)
#	n = (n & 0x3333333333333333) + ((n & 0xCCCCCCCCCCCCCCCC) >> 2)
#	n = (n & 0x0F0F0F0F0F0F0F0F) + ((n & 0xF0F0F0F0F0F0F0F0) >> 4)
#	n = (n & 0x00FF00FF00FF00FF) + ((n & 0xFF00FF00FF00FF00) >> 8)
#	n = (n & 0x0000FFFF0000FFFF) + ((n & 0xFFFF0000FFFF0000) >> 16)
#	n = (n & 0x00000000FFFFFFFF) + ((n & 0xFFFFFFFF00000000) >> 32) 
#	return n

def solve():
	N = int(input())
	count = 0
	
	# 100000毎にume
#	ume_i = []
#	ume_j = []
#	c = 1000000
	
	p = int(N/100000)

	start_i = ume_i[p]
	start_j = ume_j[p]
	if p!=0:
		count = p*100000-1
	
	x = 0
	for i in range(start_i,26):
		for j in range(start_j,10000000000000):
			a = bin(j)[2:]
			if len(a)>i:
#				print(i,j,a)
				start_j = 0
				break
#			print(a)
			if popcount(j)%3==0 and popcount(j)>=3 and a[-1]=='1':
				count += 1
#				====
#				if count == c:
#					ume_i.append(i)
#					ume_j.append(j)
#					c += 1000000
#				====
				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)
					sys.exit()

solve()
0