結果
| 問題 |
No.52 よくある文字列の問題
|
| コンテスト | |
| ユーザー |
Common Lisp
|
| 提出日時 | 2024-10-28 17:30:58 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 5,000 ms |
| コード長 | 490 bytes |
| コンパイル時間 | 260 ms |
| コンパイル使用メモリ | 33,456 KB |
| 実行使用メモリ | 30,248 KB |
| 最終ジャッジ日時 | 2024-10-28 17:31:00 |
| 合計ジャッジ時間 | 1,350 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 28 OCT 2024 05:30:58 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.006
ソースコード
(defun dfs (i j p s res)
(if (= i j)
(setf (gethash (concatenate 'string p (string (char s i))) res) p)
(progn
(dfs (1+ i) j (concatenate 'string p (string (char s i))) s res)
(dfs i (1- j) (concatenate 'string p (string (char s j))) s res))))
(defun main (&rest argv)
(declare (ignorable argv))
(let* ((s (read-line))
(res (make-hash-table :test 'equal)))
(dfs 0 (1- (length s)) "" s res)
(format t "~D~%" (hash-table-count res))))
(main)
Common Lisp