結果

問題 No.294 SuperFizzBuzz
ユーザー fmhrfmhr
提出日時 2015-10-25 17:52:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,590 bytes
コンパイル時間 1,290 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 77,292 KB
最終ジャッジ日時 2023-10-11 09:51:26
合計ジャッジ時間 31,085 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,308 KB
testcase_01 AC 75 ms
71,528 KB
testcase_02 AC 71 ms
71,360 KB
testcase_03 AC 73 ms
71,432 KB
testcase_04 AC 73 ms
71,532 KB
testcase_05 AC 75 ms
71,356 KB
testcase_06 AC 91 ms
76,564 KB
testcase_07 AC 109 ms
77,096 KB
testcase_08 AC 3,387 ms
76,896 KB
testcase_09 AC 4,244 ms
77,096 KB
testcase_10 WA -
testcase_11 AC 1,605 ms
76,740 KB
testcase_12 AC 4,100 ms
77,060 KB
testcase_13 TLE -
testcase_14 TLE -
権限があれば一括ダウンロードができます

ソースコード

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]

ume_i = [0,22, 23, 24, 24, 24, 25, 25, 25, 25, 25]
ume_j = [0,1805703, 3611383, 1222795, 7222771, 13222757, 2445581, 8445561, 14445575, 20445563, 26445559]


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
	
	# 100000毎にume
#	ume_i = []
#	ume_j = []
#	c = 1000000
	
#	if 0<=N<1000000:
#		p = 0
#	elif 1000000<=N<2000000:
#		p = 1
#	elif 2000000<=N<3000000:
#		p = 2
#	elif 3000000<=N<4000000:
#		p = 3
#	elif 4000000<=N<5000000:
#		p = 4
#	elif 5000000<=N<6000000:
#		p = 5
#	elif 6000000<=N<7000000:
#		p = 6
#	elif 7000000<=N<8000000:
#		p = 7
#	elif 8000000<=N<9000000:
#		p = 8
#	elif 9000000<=N<10000000:
#		p = 9
#	elif 10000000<=N:
#		p = 10
	p = int(N/1000000)

	start_i = ume_i[p]
	start_j = ume_j[p]
	if p!=0:
		count = p*1000000-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:
				break
			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)
#					print(ume_i)
#					print(ume_j)
					sys.exit()

solve()
0