結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー kou_kkk
提出日時 2025-07-25 22:09:55
言語 Nim
(2.2.0)
結果
WA  
実行時間 -
コード長 554 bytes
コンパイル時間 5,224 ms
コンパイル使用メモリ 73,176 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-07-25 22:10:07
合計ジャッジ時間 6,222 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 21 RE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(9, 20) Warning: replace `..b` with `0..b`; .. is deprecated [Deprecated]

ソースコード

diff #

import math, sequtils, strformat, strutils, sugar


proc parseTuple(x: string): (int, float64) =
  if '.' notin x:
    return (parseInt x, 0.0)
  let
    idx = x.find '.'
    a = parseInt x[..(idx-1)]
    b = parseFloat "0." & x[idx+1..^1]
  if x[0] != '-':
    return (a, b)
  else:
    return (a, -b)


let
  n = parseInt stdin.readLine
  seq1 = newSeq.collect:
    for _ in 0 ..< n:
      parseTuple stdin.readLine
  ans1 = sum seq1.mapIt it[0]
  ans2 = sum seq1.mapIt it[1]
  (a, b) = parseTuple $ans2

stdout.write ans1 + a
echo (&"{b:.10f}")[1..^1]
0