結果
| 問題 | No.39 桁の数字を入れ替え |
| コンテスト | |
| ユーザー |
commy
|
| 提出日時 | 2018-08-10 22:11:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 785 bytes |
| 記録 | |
| コンパイル時間 | 956 ms |
| コンパイル使用メモリ | 78,444 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-23 05:57:37 |
| 合計ジャッジ時間 | 1,676 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
using namespace std;
typedef long long int lli;
template<typename T>
vector<T> make_v(size_t a, T b) {
return vector<T>(a, b);
}
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}
int main() {
string s;
cin >> s;
set<string> st;
st.insert(s);
REP(i, 0, s.size()) {
REP(j, i + 1, s.size()) {
string tmp = s;
swap(tmp[i], tmp[j]);
st.insert(tmp);
}
}
cout << *rbegin(st) << endl;
return 0;
}
commy