結果
| 問題 | No.39 桁の数字を入れ替え |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-27 20:29:29 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 572 bytes |
| 記録 | |
| コンパイル時間 | 753 ms |
| コンパイル使用メモリ | 96,356 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-03-27 06:53:25 |
| 合計ジャッジ時間 | 2,711 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define MOD 1000000007
int main() {
string s;
cin >> s;
int n = s.size();
int ans = stoi(s);
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
string t = s;
swap(t[i], t[j]);
int res = stoi(t);
ans = max(ans, res);
}
}
cout << ans << endl;
return 0;
}