結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,384 KB
testcase_23 WA -
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 WA -
testcase_28 AC 2 ms
4,376 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:int64] =
  var minus = false
  var now = 0
  var isA = true
  var bcnt = 10_0000_00000
  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())
var aSum = F.mapIt(it.a).sum()
var bSum = F.mapIt(it.b).sum()
if aSum < 0 xor bSum < 0 :
  var minus = aSum + bSum div 10_0000_00000 < 0
  if minus:
    aSum *= -1
    bSum *= -1
  aSum -= 1
  bSum += 10_0000_00000
  if minus:
    aSum *= -1
    bSum *= -1
# echo aSum
# echo bSum
# echo F
let a = aSum + bSum div 10_0000_00000
let b = bSum mod 10_0000_00000
let B = ($b.abs) & "0".repeat(10 - ($(b.abs)).len)
echo a,".",B
0