結果
問題 | No.39 桁の数字を入れ替え |
ユーザー |
|
提出日時 | 2017-12-15 03:06:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 501 bytes |
コンパイル時間 | 1,500 ms |
コンパイル使用メモリ | 166,424 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-02 07:25:16 |
合計ジャッジ時間 | 2,185 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() #define MOD 1000003 #define INF 100000000 using namespace std; typedef long long LL; typedef vector<int> VI; typedef pair<int, int> PI; int main() { string n; cin >> n; string ans = n; REP(i, SZ(n)) { REP(j, SZ(n)) { swap(n[i], n[j]); ans = max(n, ans); swap(n[i], n[j]); } } cout << ans << endl; return 0; }