結果

問題 No.39 桁の数字を入れ替え
ユーザー te-sh
提出日時 2016-08-28 00:08:46
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 370 bytes
コンパイル時間 682 ms
コンパイル使用メモリ 98,684 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 03:47:15
合計ジャッジ時間 1,303 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.array, std.container, std.range;
import std.string, std.conv, std.math;
import std.stdio, std.typecons;

void main()
{
  auto n = readln.chomp;
  auto max = n.dup;

  foreach (i; 0..(n.length - 1))
    foreach (j; (i + 1)..n.length) {
      auto m = n.dup;
      swap(m[i], m[j]);
      if (m > max)
        max = m;
    }
  
  writeln(max);
}
0