結果
| 問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
6soukiti29
|
| 提出日時 | 2017-08-06 13:51:17 |
| 言語 | Nim (2.2.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,598 bytes |
| コンパイル時間 | 3,954 ms |
| コンパイル使用メモリ | 65,280 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-30 02:00:07 |
| 合計ジャッジ時間 | 4,295 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 WA * 3 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]
ソースコード
import sequtils,strutils,math
type
decimal = tuple[i : int64,f : float64]
proc `+` (x,y : decimal) : decimal=
result.f = x.f + y.f
result.i = x.i + y.i
if result.f < 0:
result.f = round(result.f - 1e-13,13)
else:
result.f = round(result.f,12)
result.i += result.f.int
result.f -= result.f.int.float64
proc `$` (x : decimal):string =
var s = ""
if x.f < 0:
if x.i < 0:
s &= $x.i
var n = formatBiggestFloat(x.f,ffDecimal,10)
n = n[2..n.high]
s &= n
elif x.i == 0:
s = formatBiggestFloat(x.f,ffDecimal,10)
else:
s &= $(x.i - 1)
var n = formatBiggestFloat(x.f + 1.0,ffDecimal,10)
n = n[1..n.high]
s &= n
if x.f >= 0:
if x.i == -1:
s = formatBiggestFloat(x.f,ffDecimal,10)
if x.i < -1:
s = $(x.i + 1)
var n = formatBiggestFloat(x.f - 1.0,ffDecimal,10)
n = n[2..n.high]
s &= n
else:
s = $x.i
var n = formatBiggestFloat(x.f,ffDecimal,10)
n = n[1..n.high]
s &= n
return s
proc parseDec(s : string):decimal=
var i = s.find('.')
if i == -1:
result.i = s.parseBiggestInt
else:
result.i = s[0..<i].parseBiggestInt
result.f = ("0" & s[i..s.high]).parsefloat
if s[0] == '-':
result.f *= -1
var
N = stdin.readline.parseInt
a,ans : decimal
for n in 0..<N:
a = stdin.readline.parseDec
ans = ans + a
echo ans
6soukiti29