結果
| 問題 |
No.292 芸名
|
| コンテスト | |
| ユーザー |
Common Lisp
|
| 提出日時 | 2024-10-09 10:52:01 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 1,405 bytes |
| コンパイル時間 | 1,794 ms |
| コンパイル使用メモリ | 36,240 KB |
| 実行使用メモリ | 29,760 KB |
| 最終ジャッジ日時 | 2024-10-09 10:52:04 |
| 合計ジャッジ時間 | 2,392 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 09 OCT 2024 10:52:01 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.033
ソースコード
; どこで区切るかを求める
; c1 == c2 のとき c1 で区切る
; それ以外は c1 と c2 の大小関係に注意しつつこの 2 箇所で区切る
; 区切りごとに文字を出力する
(defun main ()
; read &optional input-stream eof-error-p eof-value recursive-p ⇒ object
; string-downcase string &key start end ⇒ cased-string
; read で読み込まれたオブジェクトを string 関数や symbol-name 関数で文字列にすると
; 大文字に変換されてしまうため string-downcase を使って小文字に変換する
(let* ((s (string-downcase (read)))
(c1 (read))
(c2 (read)))
(cond
((= c1 c2)
(progn
; write-string string &optional output-stream &key start end ⇒ string
; string の start 以上 end 未満の部分文字列 を output-stream へ書き出す
(write-string s *standard-output* :end c1)
(write-string s *standard-output* :start (1+ c1))))
((> c1 c2)
(progn
(write-string s *standard-output* :end c2)
(write-string s *standard-output* :start (1+ c2) :end c1)
(write-string s *standard-output* :start (1+ c1))))
(t
(progn
(write-string s *standard-output* :end c1)
(write-string s *standard-output* :start (1+ c1) :end c2)
(write-string s *standard-output* :start (1+ c2)))))
(terpri)))
(main)
Common Lisp