結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
|
提出日時 | 2023-03-27 15:02:04 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 451 bytes |
コンパイル時間 | 1,017 ms |
コンパイル使用メモリ | 85,464 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 10:51:27 |
合計ジャッジ時間 | 1,496 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include <iostream> #include <vector> #include <string> using namespace std; int main(){ string str; cin >> str; int maxi = stoi(str); for(int i = 0 ; i < str.size() ; ++i){ for(int j = i+1 ; j < str.size() ; ++j){ char temp; temp = str[j]; string t = str; t[j] = t[i]; t[i] = temp; maxi = max(stoi(t) , maxi); } } cout << maxi << endl; }