結果
問題 | No.39 桁の数字を入れ替え |
ユーザー |
|
提出日時 | 2018-06-15 14:43:44 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 415 bytes |
コンパイル時間 | 1,421 ms |
コンパイル使用メモリ | 159,544 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 14:48:40 |
合計ジャッジ時間 | 2,103 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 WA * 8 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long int ll;int main() {cin.tie(0);ios::sync_with_stdio(false);string s;cin >> s;int t = s[0]-'0', pos = 0;for (int i = 1; i < s.size(); i++) {if (s[i]-'0' >= t) {t = s[i] -'0';pos = i;}}swap(s[0], s[pos]);cout << s << endl;return 0;}