結果
問題 | No.39 桁の数字を入れ替え |
ユーザー |
![]() |
提出日時 | 2016-05-03 16:26:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 356 bytes |
コンパイル時間 | 650 ms |
コンパイル使用メモリ | 66,720 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-02 06:55:57 |
合計ジャッジ時間 | 1,441 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include<iostream> #include<string> #include<algorithm> int main() { std::string s; std::cin >> s; int max = std::stoi(s); for (int i = 0; i < s.length(); i++) { for (int j = i + 1; j < s.length(); j++) { std::swap(s[i], s[j]); max = std::max(max, std::stoi(s)); std::swap(s[i], s[j]); } } std::cout << max << std::endl; return 0; }