結果
| 問題 | No.39 桁の数字を入れ替え | 
| コンテスト | |
| ユーザー |  めうめう🎒 | 
| 提出日時 | 2016-10-21 01:02:42 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 682 bytes | 
| コンパイル時間 | 1,136 ms | 
| コンパイル使用メモリ | 75,496 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-02 07:05:25 | 
| 合計ジャッジ時間 | 1,475 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)
int toInt(string str){
	int ret;
	stringstream ss;
	ss << str;
	ss >> ret;
	return ret;
}
int main() {
	string str;
	int ans = 0;
	cin >> str;
	ans = toInt(str);
	for(int i = 0;i < str.size();i++){
		for(int j = 0;j < str.size();j++){
			if(i == j) continue;
			string cp = str;
			swap(cp[i], cp[j]);
			int now = toInt(cp);
			ans = max(ans, now);
		}
	}
	cout << ans << endl;
	return 0;
}
            
            
            
        