結果

問題 No.39 桁の数字を入れ替え
ユーザー Common Lisp
提出日時 2024-10-23 04:01:20
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 519 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 33,352 KB
実行使用メモリ 30,140 KB
最終ジャッジ日時 2024-10-23 04:01:22
合計ジャッジ時間 1,796 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 23 OCT 2024 04:01:20 AM):

; wrote /home/judge/data/code/Main.fasl
; compilation finished in 0:00:00.053

ソースコード

diff #

(defun main (&rest argv)
  (declare (ignorable argv))
  (let* ((s (read-line))
         (a (parse-integer s)))
    (dotimes (i (length s))
      (dotimes (j i)
        (let* ((prefix (subseq s 0 j))
               (mid1 (subseq s i (1+ i)))
               (mid2 (subseq s (1+ j) i))
               (mid3 (subseq s j (1+ j)))
               (suffix (subseq s (1+ i)))
               (b (parse-integer (concatenate 'string prefix mid1 mid2 mid3 suffix))))
          (setf a (max a b)))))
    (format t "~d~%" a)))

(main)
0