結果

問題 No.347 微分と積分
ユーザー nanaenanae
提出日時 2017-02-02 17:42:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 589 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 8,112 KB
最終ジャッジ日時 2023-08-25 18:07:02
合計ジャッジ時間 1,862 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,892 KB
testcase_01 AC 14 ms
8,112 KB
testcase_02 AC 14 ms
7,980 KB
testcase_03 AC 14 ms
7,968 KB
testcase_04 AC 15 ms
8,064 KB
testcase_05 AC 14 ms
7,980 KB
testcase_06 AC 14 ms
7,912 KB
testcase_07 AC 13 ms
7,980 KB
testcase_08 AC 14 ms
8,016 KB
testcase_09 AC 14 ms
8,028 KB
testcase_10 AC 14 ms
7,976 KB
testcase_11 AC 13 ms
8,104 KB
testcase_12 AC 14 ms
7,920 KB
testcase_13 AC 13 ms
7,948 KB
testcase_14 AC 13 ms
7,920 KB
testcase_15 AC 14 ms
7,980 KB
testcase_16 AC 13 ms
7,920 KB
testcase_17 AC 13 ms
7,956 KB
testcase_18 AC 13 ms
7,984 KB
testcase_19 AC 13 ms
7,980 KB
testcase_20 AC 13 ms
7,924 KB
testcase_21 AC 13 ms
7,960 KB
testcase_22 AC 13 ms
7,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from math import log

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N = int(input())
    B = int(input())
    a = [float(i) for i in input().split()]

    dif = sum(a_i * B**(a_i - 1) for a_i in a)
    integral = 0
    for a_i in a:
        if a_i != -1:
            integral += B**(a_i + 1) / (a_i + 1)
        else:
            integral += log(B)

    print(dif)
    print(integral)
    pass

if __name__ == '__main__':
    solve()
0