結果

問題 No.39 桁の数字を入れ替え
コンテスト
ユーザー cra77756176
提出日時 2022-12-11 22:00:22
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 442 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 616 ms
コンパイル使用メモリ 196,040 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-05 05:29:25
合計ジャッジ時間 1,570 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let mut n: Vec<char> = n.trim().chars().collect();

    let mut max = n.clone();
    for i in 0..n.len() {
        for j in 0..n.len() {
            n.swap(i, j);
            if n > max {
                max = n.clone();
            }
            n.swap(i, j);
        }
    }

    let max: String = max.iter().collect();

    println!("{}", max);
}
0