結果

問題 No.39 桁の数字を入れ替え
コンテスト
ユーザー kzyKT
提出日時 2015-03-23 23:22:08
言語 D
(dmd 2.112.0)
コンパイル:
dmd -fPIE -m64 -w -wi -O -release -inline -I/opt/dmd/src/druntime/import/ -I/opt/dmd/src/phobos -L-L/opt/dmd/linux/lib64/ -fPIC _filename_
実行:
./Main
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 639 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 505 ms
コンパイル使用メモリ 84,064 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-05 06:26:14
合計ジャッジ時間 1,269 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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);
}
0