結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー yuppe19 😺yuppe19 😺
提出日時 2020-07-19 16:52:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 488 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,720 KB
実行使用メモリ 9,960 KB
最終ジャッジ日時 2023-09-29 22:53:33
合計ジャッジ時間 2,316 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
9,868 KB
testcase_01 AC 31 ms
9,936 KB
testcase_02 AC 31 ms
9,820 KB
testcase_03 AC 30 ms
9,868 KB
testcase_04 AC 31 ms
9,664 KB
testcase_05 AC 30 ms
9,732 KB
testcase_06 AC 31 ms
9,876 KB
testcase_07 AC 31 ms
9,820 KB
testcase_08 AC 32 ms
9,944 KB
testcase_09 AC 31 ms
9,816 KB
testcase_10 AC 32 ms
9,960 KB
testcase_11 AC 30 ms
9,636 KB
testcase_12 AC 30 ms
9,848 KB
testcase_13 AC 31 ms
9,840 KB
testcase_14 AC 31 ms
9,700 KB
testcase_15 AC 31 ms
9,736 KB
testcase_16 AC 31 ms
9,688 KB
testcase_17 AC 30 ms
9,856 KB
testcase_18 AC 31 ms
9,704 KB
testcase_19 AC 30 ms
9,712 KB
testcase_20 AC 31 ms
9,688 KB
testcase_21 AC 30 ms
9,884 KB
testcase_22 AC 31 ms
9,848 KB
testcase_23 AC 31 ms
9,692 KB
testcase_24 AC 31 ms
9,936 KB
testcase_25 AC 31 ms
9,676 KB
testcase_26 AC 31 ms
9,700 KB
testcase_27 AC 32 ms
9,660 KB
testcase_28 AC 31 ms
9,808 KB
testcase_29 AC 31 ms
9,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# †
from fractions import Fraction as frac

def f(a, b):
    sign = '-' if a < 0 else ''
    a = abs(a)
    integer, rem = divmod(a, b)
    v = []
    for _ in range(10):
        rem *= 10
        quo, rem = divmod(rem, b)
        v.append(quo)
    return '{}{}.{}'.format(sign, integer, ''.join(map(str, v)))


###
if __name__ == '__main__':
    n = int(input())
    s = sum(frac(input()) for _ in range(n))
    res = f(s.numerator, s.denominator)
    print(res)
0