結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
|
提出日時 | 2025-04-29 22:12:29 |
言語 | Common Lisp (sbcl 2.5.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 924 bytes |
コンパイル時間 | 630 ms |
コンパイル使用メモリ | 29,460 KB |
実行使用メモリ | 25,764 KB |
最終ジャッジ日時 | 2025-04-29 22:12:31 |
合計ジャッジ時間 | 1,859 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 2 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 29 APR 2025 10:12:29 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.197
ソースコード
(defparameter N (make-array 9)) (defparameter keta 0) (loop for char = (read-char nil nil) do (if (eq char #\Newline) (return)) (setf (aref N keta) (digit-char-p char)) (incf keta) ) ;(print N) ;(print keta) (defvar st) (defvar swapf) (defvar temp) (defvar maxn) (defvar maxi) (loop for j from 0 to (- keta 2) do (setq swapf nil) (setq maxn -1) (setq st j) (loop for i from (+ st 1) to (- keta 1) do (if (< maxn (aref N i)) (progn (setq maxn (aref N i)) (setq maxi i ))) ) (if (< (aref N st) maxn) (progn (setq temp (aref N st)) (setf (aref N st) maxn) (setf (aref N maxi) temp) (setq swapf t) ) ) (if swapf (return)) ) ;(print N) ;(print keta) (loop for i from 0 to (- keta 1) do (format t "~d" (aref N i)) ) (format t "~%" )