結果

問題 No.39 桁の数字を入れ替え
ユーザー Maitneel
提出日時 2019-01-12 15:39:58
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 300 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 57,820 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-21 07:22:07
合計ジャッジ時間 1,387 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
	string n;
	cin >> n;
	int max_num = 0, max_index = 0;
	int i;
	for(i = 0; i < n.length(); i++) {
		if(max_num <= n.at(i)) {
			max_num = n.at(i);
			max_index = i;
		}
	}
	swap(n.at(0), n.at(max_index));
	cout << n << endl;
}
0