結果
| 問題 | No.39 桁の数字を入れ替え | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-11-24 14:00:22 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 5,000 ms | 
| コード長 | 382 bytes | 
| コンパイル時間 | 1,748 ms | 
| コンパイル使用メモリ | 166,956 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-24 19:12:01 | 
| 合計ジャッジ時間 | 2,442 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s; cin >> s;
	int ans = stoi(s);
	for(int i = 0; i < s.size(); i++) {
		for(int j = i + 1; j < s.size(); j++) {
			string t = s;
			char tmp = t[i];
			t[i] = t[j];
			t[j] = tmp;
			ans = max(ans, stoi(t));
		}
	}
	cout << ans << endl;
	return 0;	
}
            
            
            
        