結果
問題 | No.39 桁の数字を入れ替え |
ユーザー |
![]() |
提出日時 | 2015-04-24 18:30:06 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 447 bytes |
コンパイル時間 | 681 ms |
コンパイル使用メモリ | 93,548 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 02:33:30 |
合計ジャッジ時間 | 1,328 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
import std.stdio, std.algorithm, std.conv, std.array, std.string; void main() { auto line = readln().strip(); string ans = line; for (int i = 0; i < line.length - 1; ++i) { for (int j = i + 1; j < line.length; ++j) { char[] s = line.to!(char[]); auto tmp = s[i]; s[i] = s[j]; s[j] = tmp; if (ans < s.to!string) ans = s.to!string; } } writeln(ans); }