結果

問題 No.39 桁の数字を入れ替え
コンテスト
ユーザー あるふぁ
提出日時 2026-08-31 21:19:48
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 350 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,891 ms
コンパイル使用メモリ 349,396 KB
実行使用メモリ 7,732 KB
最終ジャッジ日時 2026-08-31 21:20:01
合計ジャッジ時間 6,472 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    string S;
    cin >> S;

    ll ans = 0;
    for (int i = 0; i < S.size(); i++){
        for (int j = i+1; j < S.size(); j++){
            string s = S;
            swap(s[i], s[j]);
            ans = max(ans, stoll(s));
        }
    }

    cout << ans << endl;
}
0