結果

問題 No.39 桁の数字を入れ替え
ユーザー Navier_Boltzmann
提出日時 2024-01-01 20:28:42
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 546 bytes
コンパイル時間 5,551 ms
コンパイル使用メモリ 307,988 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-27 17:28:56
合計ジャッジ時間 6,378 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>


using namespace std;
using namespace atcoder;
#define rep(i,m,n,k) for (int i = (int)(m); i < (int)(n); i += (int)(k))
#define ll long long
#define list(T,A,N) vector<T> A(N);for(int i=0;i<(int)(N);i++){cin >> A[i];}

int main(){
    
    string N;
    cin >> N ;
    ll ans = (ll)stoi(N);
    ll n = N.size();
    rep(i,0,n-1,1){
        rep(j,i+1,n,1){
            swap(N[i],N[j]);
            ans = max(ans,(ll)stoi(N));
            swap(N[i],N[j]);
        }
    }
    cout << ans << endl;

}
0