結果
問題 | No.39 桁の数字を入れ替え |
ユーザー |
|
提出日時 | 2015-03-23 23:22:08 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 639 bytes |
コンパイル時間 | 746 ms |
コンパイル使用メモリ | 98,400 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 02:32:15 |
合計ジャッジ時間 | 1,536 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
import std.stdio; import std.string; import std.conv; import std.range; import std.array; import std.algorithm; import std.typecons; import std.math; void main() { string[] cin; cin=split(readln()); string s=to!string(cin[0]); string ans=s; for(int i=0; i<s.length-1; i++) { for(int j=i+1; j<s.length; j++) { string t=s[0..i]; string t2=s[i..i+1]; string t3=s[i+1..j]; string t4=s[j..j+1]; string t5=s[j+1..s.length]; t~=t4; t~=t3; t~=t2; t~=t5; if(ans<t) ans=t; } } writeln(ans); }