結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
|
提出日時 | 2019-09-06 02:03:17 |
言語 | Scheme (Gauche-0.9.15) |
結果 |
AC
|
実行時間 | 55 ms / 5,000 ms |
コード長 | 500 bytes |
コンパイル時間 | 162 ms |
コンパイル使用メモリ | 5,376 KB |
実行使用メモリ | 20,480 KB |
最終ジャッジ日時 | 2024-06-23 03:02:30 |
合計ジャッジ時間 | 2,022 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
(use scheme.vector) (use gauche.collection) (use util.combinations) (let* ((n (read))) (define vec (string->vector (number->string n))) (print (apply max (cons n #?=(let loop ((is (combinations (iota (vector-length vec)) 2))) (cond ((null? is) '()) (else (let ((vec-copied (vector-copy vec)) (pair (car is))) (vector-swap! vec-copied (car pair) (cadr pair)) (cons (string->number (vector->string vec-copied)) (loop (cdr is)))))))))))