結果
| 問題 | No.39 桁の数字を入れ替え | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-09-06 01:59:53 | 
| 言語 | Scheme (Gauche-0.9.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 49 ms / 5,000 ms | 
| コード長 | 545 bytes | 
| コンパイル時間 | 94 ms | 
| コンパイル使用メモリ | 5,504 KB | 
| 実行使用メモリ | 20,992 KB | 
| 最終ジャッジ日時 | 2024-06-23 02:58:28 | 
| 合計ジャッジ時間 | 2,278 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
(use scheme.vector) (use gauche.collection) (use util.combinations) (let* ((n (read))) (define vec (vector-map char->integer (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 (list->string (map integer->char vec-copied))) (loop (cdr is)))))))))))
