結果

問題 No.294 SuperFizzBuzz
ユーザー lip_of_cygnuslip_of_cygnus
提出日時 2015-11-07 14:01:00
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 1,012 bytes
コンパイル時間 733 ms
コンパイル使用メモリ 6,660 KB
実行使用メモリ 6,092 KB
最終ジャッジ日時 2023-10-11 15:03:29
合計ジャッジ時間 1,569 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,044 KB
testcase_01 AC 11 ms
6,068 KB
testcase_02 AC 12 ms
5,996 KB
testcase_03 AC 11 ms
6,076 KB
testcase_04 AC 11 ms
6,000 KB
testcase_05 AC 11 ms
5,964 KB
testcase_06 AC 12 ms
6,012 KB
testcase_07 AC 12 ms
5,928 KB
testcase_08 AC 12 ms
6,048 KB
testcase_09 AC 12 ms
5,924 KB
testcase_10 AC 12 ms
5,924 KB
testcase_11 AC 12 ms
5,924 KB
testcase_12 AC 12 ms
6,000 KB
testcase_13 AC 12 ms
6,092 KB
testcase_14 AC 12 ms
6,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

r=int(raw_input())
j=1
i=0
a=0
b=""
appin=0
con = [[0] * 100 for i in range(100)]
xx=1
z=""


def consome(n,k):
	j=0
	if con[n][k]!=0:
		return con[n][k]
	else:
		for i in range (0,1000):
			zz=3*i+(k+2)%3
			if zz>=n:
				break
			j=j+pp(n-1,zz)/pp(zz,zz)
			i=i+1
	con[n][k]=j
	return con[n][k]

def pp(a,b):
	rr=1
	for i in range (0,b):
		rr=rr*(a-i)
	return rr

while r>consome(xx,0):
	r=r-consome(xx,0)
	xx=xx+1
	continue

#print xx
m=0
while xx!=1:
	if r>consome(xx-1,m):
		r=r-consome(xx-1,m)
		z=z+'5'	
		m=(m-1)%3	
	else:
		z=z+'3'
	xx=xx-1
print z+'5'
'''
	while appin!=1 or j<2**k:
		if j>=2**k:
			k=k+1
			j=1
		b='0'+str(k)+'b'
		z=str(format (j,b))
		if z.count("1")%3==0:
	
			i=i+1
			if i==n:
				z=z.replace("0","3")
				z=z.replace("1","5")		
				w=z
				appin=1
		j=j+2

	
print w
'''
'''
while i<n:	
	z=str(30*a+15)	
	for j in range (0,len(z)):
		if (z[j]=="3" or z[j]=="5"):
			k=k+1
	if len(z)==k:
		i=i+1
	a=a+1
	k=0
print z
'''
0