結果

問題 No.256 桁の数字を入れ替え (2)
ユーザー nopperinopperi
提出日時 2015-09-10 08:39:32
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 465 bytes
コンパイル時間 464 ms
コンパイル使用メモリ 52,172 KB
実行使用メモリ 7,780 KB
最終ジャッジ日時 2023-09-26 10:24:05
合計ジャッジ時間 3,966 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 TLE -
testcase_03 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(void) {
    string num;
    cin >> num;
    for (int i = 0; i < num.length(); i++) {
        int max = i;
        for (int j = num.length()-1; j > i; j--) {
            if (num[max] < num[j]) {
                max = j;
            }
        }
        if (max != i) {
            char tmp = num[i];
            num[i] = num[max];
            num[max] = tmp;
        }
    }
    cout << num << endl;
    return 0;
}
0