結果
| 問題 | No.39 桁の数字を入れ替え | 
| コンテスト | |
| ユーザー |  nayuta | 
| 提出日時 | 2019-12-20 22:53:35 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 432 bytes | 
| コンパイル時間 | 1,667 ms | 
| コンパイル使用メモリ | 170,940 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-18 01:11:19 | 
| 合計ジャッジ時間 | 2,118 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
int main() {
  string s;
  cin >> s;
  int ans = toInt(s);
  for (int i = 0; i + 1 < s.size(); i++) {
    for (int j = i + 1; j < s.size(); j++) {
      swap(s[i], s[j]);
      int ch = toInt(s);
      ans = max(ans, ch);
      swap(s[i], s[j]);
    }
  }
  cout << ans << endl;
  return 0;
}
            
            
            
        