結果

問題 No.428 小数から逃げる夢
ユーザー t8m8⛄️
提出日時 2016-11-01 00:21:09
言語 Nim
(2.2.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 488 bytes
コンパイル時間 2,948 ms
コンパイル使用メモリ 66,400 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-29 19:50:52
合計ジャッジ時間 5,378 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 18) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import strutils, sequtils

const d = "1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991"

var
  n = stdin.readline.parseint
  carry = 0
  ans = ""

for i in countDown(d.len-1, 0):
  carry += n*(d[i].ord - '0'.ord)
  ans &= $(carry mod 10)
  carry = carry div 10

for i in 0..ans.high div 2:
  swap(ans[i], ans[ans.high-i])

echo $carry & "." & ans
0