結果

問題 No.39 桁の数字を入れ替え
ユーザー square1001
提出日時 2016-10-29 17:51:22
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 307 bytes
コンパイル時間 1,451 ms
コンパイル使用メモリ 166,972 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-24 18:05:29
合計ジャッジ時間 2,227 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
	cin >> s;
	for(int i = 9; i > s[0] - 48; i--) {
		bool ok = false;
		for(int j = 1; j < s.size(); j++) {
			if(s[j] - 48 == i) {
				swap(s[0], s[j]);
				ok = true;
				break;
			}
		}
		if(ok) break;
	}
	cout << s << endl;
	return 0;
}
0