結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
|
提出日時 | 2019-09-06 01:49:07 |
言語 | Scheme (Gauche-0.9.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 529 bytes |
コンパイル時間 | 179 ms |
コンパイル使用メモリ | 6,812 KB |
実行使用メモリ | 20,864 KB |
最終ジャッジ日時 | 2024-06-23 02:44:49 |
合計ジャッジ時間 | 2,964 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 WA * 1 |
ソースコード
(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 #?=(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))))))))))