結果

問題 No.18 うーさー暗号
ユーザー MOD9cXWdOsRxvPy
提出日時 2022-10-31 21:11:21
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 472 bytes
コンパイル時間 59 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 16,384 KB
最終ジャッジ日時 2024-07-08 09:25:58
合計ジャッジ時間 1,323 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

(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