結果

問題 No.18 うーさー暗号
コンテスト
ユーザー MOD9cXWdOsRxvPy
提出日時 2022-10-31 21:11:21
言語 Scheme
(Gauche-0.9.15)
コンパイル:
true
実行:
gosh _filename_
結果
AC  
実行時間 19 ms / 5,000 ms
コード長 472 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 214 ms
コンパイル使用メモリ 7,844 KB
実行使用メモリ 16,512 KB
最終ジャッジ日時 2026-03-30 02:37:11
合計ジャッジ時間 1,717 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

(define cchar-clist (string-split "ZYXWVUTSRQPONMLKJIHGFEDCBA" ""))

(set-cdr! (last-pair cchar-clist) cchar-clist)

(define (char-shift c x)
  (car (drop (member c cchar-clist) x))
  )

(define (decode str)
  (define (dec-iter i sl r)
    (if (null? sl) (string-join (reverse r) "")
	(dec-iter
	 (+ i 1)
	 (cdr sl)
	 (cons (char-shift (car sl) i) r)))
    )
   (dec-iter 1 (string-split str "") ())
  )

(define (main _)
  (display (decode (read-line)))
  (newline)
  0)
0