結果

問題 No.39 桁の数字を入れ替え
ユーザー latte0119
提出日時 2015-05-04 13:10:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 330 bytes
コンパイル時間 451 ms
コンパイル使用メモリ 60,788 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 18:52:48
合計ジャッジ時間 995 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main(){
	string str;
	cin >> str;
	char ma = *max_element(str.begin(), str.end());
	for (int i = (int)str.size() - 1; i >= 0; i--){
		if (ma == str[i]){
			swap(str[0], str[i]);
			break;
		}
	}
	
	cout << str << endl;
	return 0;
}
0