結果

問題 No.701 ひとりしりとり
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-06-15 23:53:35
言語 Nim
(2.0.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 570 bytes
コンパイル時間 756 ms
コンパイル使用メモリ 55,188 KB
最終ジャッジ日時 2023-09-13 05:29:25
合計ジャッジ時間 1,100 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
/home/judge/data/code/Main.nim(11, 11) Error: attempting to call undeclared routine: 'safeAdd'

ソースコード

diff #

import strutils

let n = stdin.readLine.parseInt
var dic, last = ""

proc trfm(S: string): string =
  var bufStr = ""
  for s in S: bufStr.add (s.int - 'a'.int).repr
  let bufInt = bufStr.parseInt + 1
  for s in $bufInt:
    result.safeAdd ((s & "").parseInt + 'a'.int).chr

for c in ('a' .. 'y'): dic.add $c
dic.add "a"
dic = dic.replace("n", "z")

var cnt = 0
proc judge =
  cnt += 1
  if cnt >= n: echo last & "n"; quit()

var mid = "a"
while true:
  for i in 0 ..< dic.high:
    judge()
    echo dic[i] & mid & dic[i + 1]
    last = dic[i + 1] & ""
  mid = mid.trfm
0