結果

問題 No.39 桁の数字を入れ替え
ユーザー pmx_x
提出日時 2019-09-06 12:05:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 442 bytes
コンパイル時間 1,786 ms
コンパイル使用メモリ 167,260 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-23 18:36:49
合計ジャッジ時間 2,438 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

 #include<bits/stdc++.h>

#define ALL(v) v.begin(), v.end()
typedef long long ll;



using namespace std;
int main() {
	string n,temp;
	int maxx = 0;
	cin >> n;
	
	maxx = stoi(n);

	for (int i = 0; i < n.length(); i++)
	{
		for (int j = 0; j < n.length(); j++)
		{
			temp = n;

			char a = n[i];
			char b = n[j];

			temp[i] = b;
			temp[j] = a;

			int tempI = stoi(temp);

			maxx = max(maxx, tempI);

		}
	}

	
	cout << maxx << endl;


}
0