結果

問題 No.39 桁の数字を入れ替え
ユーザー sggkshio
提出日時 2016-11-13 23:53:41
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 613 bytes
コンパイル時間 714 ms
コンパイル使用メモリ 83,872 KB
実行使用メモリ 50,304 KB
最終ジャッジ日時 2024-10-02 07:14:36
合計ジャッジ時間 2,155 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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