結果

問題 No.639 An Ordinary Sequence
ユーザー kwnwsdnc
提出日時 2018-02-23 00:02:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 462 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-10-04 09:20:59
合計ジャッジ時間 1,394 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other AC * 2 RE * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

def sequence(n):
    if n==0:
        return 1
    else:
        return sequence(int(n/3))+sequence(int(n/5))
    
def fact(n):
    if n==1:
        return 1
    else:
        return n*fact(n-1)
    
def com(a,b):
    if a==b:
        return 1
    else:
        return fact(a)/fact(b)/fact(a-b)


N=int(input())
list=[]
i=0
j=0
M=N
total=0
while M>1:
    M=M/5
    i+=1

while j<=i:
    total+=com(i,j)*sequence(M*((5/3)**j))
    j+=1
    



print('%d'%total)

0