結果
問題 |
No.701 ひとりしりとり
|
ユーザー |
![]() |
提出日時 | 2022-07-14 07:53:14 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 128 ms / 2,000 ms |
コード長 | 566 bytes |
コンパイル時間 | 4,872 ms |
コンパイル使用メモリ | 64,128 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 13:58:02 |
合計ジャッジ時間 | 5,215 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
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.add ((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