結果
問題 | No.39 桁の数字を入れ替え |
ユーザー |
|
提出日時 | 2020-07-17 01:27:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 770 bytes |
コンパイル時間 | 1,308 ms |
コンパイル使用メモリ | 106,552 KB |
最終ジャッジ日時 | 2025-01-11 21:42:36 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 WA * 8 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>#include <map>#include <queue>#include <cstdio>#include <ctime>#include <assert.h>#include <chrono>#include <random>#include <numeric>#include <set>using namespace std;typedef long long int ll;typedef unsigned long long ull;int main(){cin.tie(nullptr);ios::sync_with_stdio(false);string s; cin >> s;int n; n=s.size();for(int i=0;i<n;i++){char mx=s[i];for(int j=i+1;j<n;j++){mx=max(mx,s[j]);}if(mx>s[i]){for(int j=n-1;j>=i+1;j--){if(s[j]==mx){swap(s[i],s[j]);}break;}break;}}cout << s << endl;}