結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー むらためむらため
提出日時 2018-12-18 04:24:07
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 1,190 bytes
コンパイル時間 2,119 ms
コンパイル使用メモリ 66,988 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-13 21:41:31
合計ジャッジ時間 3,788 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 8 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc putchar_unlocked(c:char){.header: "<stdio.h>" .}
proc printInt(a:int,skipLeavingZeros:bool = false) =
  # https://stackoverflow.com/questions/18006748/using-putchar-unlocked-for-fast-output
  if a == 0:
    putchar_unlocked('0')
    return
  var n = a
  var rev = a
  var cnt = 0
  while rev mod 10 == 0:
    cnt += 1
    rev = rev div 10
  rev = 0
  while n != 0:
    rev = (rev shl 3) + (rev shl 1) + n mod 10
    n = n div 10
  while rev != 0:
    putchar_unlocked((rev mod 10 + '0'.ord).chr)
    rev = rev div 10
  if not skipLeavingZeros:
    while cnt != 0:
      putchar_unlocked('0')
      cnt -= 1

proc printFloat(a,b:int) =
  if a == 0:
    putchar_unlocked('0')
  else:
    printInt(a div b)
    if a mod b != 0:
      putchar_unlocked('.')
      const leaving = 1000000
      printInt((a * leaving div b) mod leaving,true)
  putchar_unlocked('\n')

var S : array[100002,char]
var left = 0
var l = 0
while true:
  l += 1
  let c = getchar_unlocked()
  S[l] = c
  if c == 'o' : left += 1
  elif c != 'x': break
left *= 100
for i in 1..<l:
  printFloat(left,l-i)
  if S[i] == 'o' : left -= 100
0