結果

問題 No.39 桁の数字を入れ替え
ユーザー oooooba
提出日時 2021-09-11 20:50:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 650 bytes
コンパイル時間 1,237 ms
コンパイル使用メモリ 112,800 KB
最終ジャッジ日時 2025-01-24 13:07:53
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std; // NOLINT

int main() {
    string n;
    cin >> n;
    int32_t ans = 0;
    for (size_t i = 0; i < n.size(); ++i) {
        for (size_t j = 0; j < n.size(); ++j) {
            swap(n[i], n[j]);
            auto x = stoi(n);
            ans = max(ans, x);
            swap(n[i], n[j]);
        }
    }
    cout << ans << endl;
    return 0;
}
0