結果

問題 No.39 桁の数字を入れ替え
ユーザー not_522not_522
提出日時 2015-07-16 22:33:52
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 297 bytes
コンパイル時間 1,262 ms
コンパイル使用メモリ 161,320 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-02 06:30:32
合計ジャッジ時間 1,969 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  string n;
  cin >> n;
  string res = n;
  for (size_t i = 0; i < n.size(); ++i) {
    for (size_t j = i + 1; j < n.size(); ++j) {
      string m = n;
      swap(m[i], m[j]);
      res = max(res, m);
    }
  }
  cout << res << endl;
}
0