結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー むらためむらため
提出日時 2019-01-24 12:39:10
言語 Nim
(2.0.0)
結果
WA  
実行時間 -
コード長 971 bytes
コンパイル時間 3,287 ms
コンパイル使用メモリ 69,932 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-14 02:42:44
合計ジャッジ時間 4,114 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,376 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,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 WA -
testcase_28 AC 2 ms
4,380 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils,math,strutils

proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  while true:
    let k = getchar_unlocked()
    if k < '0': break
    result = 10 * result + k.ord - '0'.ord

proc scanFixed(): tuple[a,b:int] =
  var minus = false
  var now = 0
  var isA = true
  var bcnt = 10_0000_0000
  while true:
    let k = getchar_unlocked()
    if k == '-' : minus = true
    elif k == '.':
      if minus : now *= -1
      result.a = now
      now = 0
      isA = false
    elif k < '0':
      if minus : now *= -1
      if isA : result.a = now
      else: result.b = now * bcnt
      return
    else:
      now = 10 * now + k.ord - '0'.ord
      if not isA: bcnt = bcnt div 10


let n = scan()
let F = newSeqWith(n,scanFixed())
let aSum = F.mapIt(it.a).sum()
let bSum = F.mapIt(it.b).sum()
let a = aSum + bSum div 10_0000_0000
let b = bSum mod 10_0000_0000
let B = ($b) & "0".repeat(10 - ($b).len)
echo a,".",B
0