結果
問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
ユーザー |
![]() |
提出日時 | 2025-07-26 02:10:19 |
言語 | Nim (2.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 744 bytes |
コンパイル時間 | 7,818 ms |
コンパイル使用メモリ | 72,944 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-07-26 02:10:30 |
合計ジャッジ時間 | 6,940 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 WA * 2 |
ソースコード
import math, sequtils, strformat, strutils, sugar proc parseTuple(x: string): (int64, float64) = if '.' notin x: return (x.parseInt, 0.0) let idx = x.find '.' a = parseInt x[0..(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] var (a, b) = parseTuple &"{ans2:.12f}" a += ans1 if (a == 0) and (b < 0): echo &"{b:.10f}" quit() if (a > 0) and (b < 0): b = 1.0 + b a -= 1 if (a < 0) and (b > 0): b = 1.0 - b a += 1 if b < 0: b = abs b stdout.write a echo (&"{b:.10f}")[1..^1]