結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー lloyzlloyz
提出日時 2023-09-05 20:37:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 974 bytes
コンパイル時間 597 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 71,648 KB
最終ジャッジ日時 2023-09-05 20:37:38
合計ジャッジ時間 4,488 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
71,504 KB
testcase_01 AC 76 ms
71,364 KB
testcase_02 AC 73 ms
71,308 KB
testcase_03 WA -
testcase_04 AC 74 ms
71,528 KB
testcase_05 AC 74 ms
71,392 KB
testcase_06 AC 75 ms
71,456 KB
testcase_07 AC 74 ms
71,332 KB
testcase_08 AC 74 ms
71,336 KB
testcase_09 AC 74 ms
71,132 KB
testcase_10 AC 72 ms
71,452 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 73 ms
71,308 KB
testcase_14 AC 73 ms
71,372 KB
testcase_15 AC 76 ms
71,292 KB
testcase_16 AC 73 ms
71,360 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 78 ms
71,276 KB
testcase_26 AC 72 ms
71,252 KB
testcase_27 AC 71 ms
71,368 KB
testcase_28 AC 75 ms
71,136 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
i, f = 0, 0
max_f = 10**10
for _ in range(n):
    a = input()
    if '.' in a:
        ai, af = a.split('.')
        ai = int(ai)
        i += ai
        p = 10 - len(af)
        af = int(af)
        if a[0] == '-':
            f -= af * pow(10, p)
            # if f < 0:
            #     if i == 0 and not minus:
            #         minus = True
            #     else:
            #         i -= 1
            #         f += max_f
        else:
            f += af * pow(10, p)
            # if f >= max_f:
            #     if i == 0 and minus:
            #         minus = False
            #     else:
            #         i += 1
            #         f -= max_f
    else:
        i += int(a)
i, f = str(i), str(f)
if i == '0' and f[0] == '-':
    i = '-' + i
    f = f[1:]
elif len(f) > 10 or f[0] == '-':
    q, f = divmod(int(f), max_f)
    i = str(int(i) + q)
    f = str(f)
if len(f) < 10:
    f = '0' * (10 - len(f)) + f
print(i + '.' + f)
0