結果

問題 No.39 桁の数字を入れ替え
ユーザー sggkshiosggkshio
提出日時 2016-11-13 23:53:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 613 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 84,012 KB
実行使用メモリ 51,136 KB
最終ジャッジ日時 2024-04-10 05:39:18
合計ジャッジ時間 1,859 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
50,188 KB
testcase_01 AC 18 ms
50,240 KB
testcase_02 AC 18 ms
50,372 KB
testcase_03 AC 18 ms
50,216 KB
testcase_04 AC 20 ms
50,204 KB
testcase_05 AC 18 ms
50,204 KB
testcase_06 AC 18 ms
50,400 KB
testcase_07 AC 18 ms
50,288 KB
testcase_08 AC 18 ms
50,240 KB
testcase_09 AC 19 ms
50,172 KB
testcase_10 AC 18 ms
50,336 KB
testcase_11 AC 17 ms
50,632 KB
testcase_12 AC 18 ms
51,136 KB
testcase_13 AC 18 ms
50,324 KB
testcase_14 AC 18 ms
50,352 KB
testcase_15 AC 18 ms
50,244 KB
testcase_16 AC 19 ms
50,372 KB
testcase_17 AC 19 ms
50,308 KB
testcase_18 AC 18 ms
50,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>



using namespace std;


set<int>x[1000005];
bool f[1000005];

int main() {

	
	string p;
	cin>>p;
	for(int i=0;i<p.size();i++){
		char r=p[i];int x=i;
		for(int j=i+1;j<p.size();j++){
			if(r<=p[j]){
				r=p[j];
				x=j;
			}
		}
		if(r!=p[i]){
			swap(p[i],p[x]);
			cout<<p<<endl;
			return 0;
		}
	}
	cout<<p<<endl;

	
	return 0;
}

	
0