結果

問題 No.347 微分と積分
ユーザー rocoder
提出日時 2017-08-01 16:52:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 759 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-10-11 00:14:25
合計ジャッジ時間 1,776 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 RE * 2
other AC * 5 WA * 13 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

# your code goes here
import math
N=int(input())
B=int(input())
a=[float(i) for i in input().split()]
pa=[0.0]*N
d=0.0
for i in range(N):
 #   print(i)
    dn=1.0
    pa[i]=a[i]
  #  print(pa)
    if a[i]>0.0:
        j=a[i]-1
        while j>0:
            dn*=B
            j-=1
        #    print(dn)
    else:
        j=-1*a[i]+1
        while j>0:
            dn*=B
            j-=1
        dn=1/dn
    dn*=pa[i]
    d+=dn
print(d)
d=0.0
for i in range(N):
    dn=1.0
    pa[i]+=1
    pa[i]=1/pa[i]
    if a[i]>0:
        j=a[i]+1
        while j>0:
            dn*=B
            j-=1
    elif a[i]==-1:
        dn=log(B)
    else:
        j=-1*a[i]-1
        while j>0:
            dn*=B
            j-=1
        dn=1/dn
    dn*=pa[i]
    d+=dn
print(d)
0