結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
|
提出日時 | 2018-08-13 21:54:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 467 bytes |
コンパイル時間 | 1,552 ms |
コンパイル使用メモリ | 167,464 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 08:18:51 |
合計ジャッジ時間 | 2,146 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(void) { #ifdef DEBUG freopen("input.txt", "r", stdin); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); string N; cin >> N; int l = N.size(); string num, maxn; maxn = N; for (int i = 0; i < l - 1; i++) { for (int j = i + 1; j < l; j++) { num = N; swap(num[i], num[j]); maxn = max(maxn, num); } } cout << maxn << endl; return 0; }