結果
問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
ユーザー |
|
提出日時 | 2017-01-23 01:10:31 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 28 ms / 5,000 ms |
コード長 | 626 bytes |
コンパイル時間 | 519 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-22 16:37:50 |
合計ジャッジ時間 | 1,647 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
N = int(input()) cum = 0 for n in range(N): a = input() if '.' in a: a_1, a_2 = a.split('.') a1 = int(a_1) * 10**10 a2 = int(a_2) * 10 ** (10 - len(a_2)) if a_1.startswith('-'): a = a1 - a2 else: a = a1 + a2 else: a = int(a) * 10 ** 10 cum += a if abs(cum) < 10**10: if cum > 0: str_cum = '0' * (11 - len(str(cum))) + str(cum) elif cum < 0: str_cum = '-' + '0' * (11 - len(str(abs(cum)))) + str(abs(cum)) else: str_cum = '0' * 11 else: str_cum = str(cum) print(str_cum[:-10] + '.' + str_cum[-10:])