結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー ayaoniayaoni
提出日時 2020-12-11 23:06:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 1,066 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 71,500 KB
最終ジャッジ日時 2023-09-29 22:57:12
合計ジャッジ時間 3,919 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,064 KB
testcase_01 AC 74 ms
71,400 KB
testcase_02 AC 77 ms
71,300 KB
testcase_03 AC 83 ms
71,112 KB
testcase_04 AC 77 ms
71,100 KB
testcase_05 AC 77 ms
71,108 KB
testcase_06 AC 77 ms
71,232 KB
testcase_07 AC 76 ms
71,464 KB
testcase_08 AC 75 ms
71,496 KB
testcase_09 AC 76 ms
71,308 KB
testcase_10 AC 75 ms
71,364 KB
testcase_11 AC 75 ms
71,500 KB
testcase_12 AC 73 ms
71,188 KB
testcase_13 AC 72 ms
71,436 KB
testcase_14 AC 75 ms
71,308 KB
testcase_15 AC 74 ms
71,116 KB
testcase_16 AC 74 ms
71,184 KB
testcase_17 AC 75 ms
71,320 KB
testcase_18 AC 75 ms
71,104 KB
testcase_19 AC 80 ms
71,360 KB
testcase_20 AC 78 ms
71,320 KB
testcase_21 AC 78 ms
71,296 KB
testcase_22 AC 75 ms
71,396 KB
testcase_23 AC 73 ms
71,296 KB
testcase_24 AC 72 ms
71,264 KB
testcase_25 AC 73 ms
71,156 KB
testcase_26 AC 76 ms
71,120 KB
testcase_27 AC 76 ms
71,296 KB
testcase_28 AC 75 ms
71,400 KB
testcase_29 AC 75 ms
71,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N = I()
ans = 0
for _ in range(N):
    A = S()
    if '.' in A:
        for i in range(100):
            if A[i] == '.':
                index = i
                break
        X = abs(int(A[:index]))
        Y = int(A[index+1:])*10**(10-(len(A)-index-1))
        if A[0] == '-':
            ans -= X*10**10+Y
        else:
            ans += X*10**10+Y
    else:
        ans += int(A)*10**10

if ans >= 0:
    q,r = divmod(ans,10**10)
    r = '0'*(10-len(str(r)))+str(r)
    print(str(q)+'.'+r)
else:
    ans = abs(ans)
    q,r = divmod(ans,10**10)
    r = '0'*(10-len(str(r)))+str(r)
    print('-'+str(q)+'.'+r)
0