結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー 6soukiti296soukiti29
提出日時 2019-07-18 23:39:08
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 981 bytes
コンパイル時間 2,832 ms
コンパイル使用メモリ 68,380 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-14 23:36:41
合計ジャッジ時間 3,998 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,384 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import sequtils,strutils

var
    a : int64
    b : int64
    N = stdin.readline.parseInt

for i in 1..N:
    var s = stdin.readline
    var t : int64
    var u : int64
    var s2 : string = ""
    var p : int64 = 1
    for j,k in s:
        if k == '-':
            p *= -1
            continue
        if k == '.':
            s2 = s[(j + 1) .. s.high]
            break
        t *= 10
        t += ord(k) - ord('0')
    for j in 0..9:
        if s2.high < j:
            u *= 10
        else:
            u *= 10
            u += ord(s2[j]) - ord('0')
    a += t * p
    b += u * p
    

if b >= 1_000_000_000_0:
    a += b div 1_000_000_000_0
    b = b mod 1_000_000_000_0
if b < 0 and a > 0:
    b += 1_000_000_000_00
    a -= 1
elif b < 0 and a < 0:
    b *= -1
elif b < 0 and a == 0:
    b *= -1
    var bs = $b
    while bs.len < 10:
        bs &= '0'
    echo "-0.",bs
    quit()
    
var bs = $b
while bs.len < 10:
    bs &= '0'
echo a,".",bs
            
        

    
0