結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
![]() |
提出日時 | 2019-07-13 09:53:13 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 525 bytes |
コンパイル時間 | 495 ms |
コンパイル使用メモリ | 60,376 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-21 13:45:34 |
合計ジャッジ時間 | 1,164 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 12 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <string> using namespace std; typedef long long ll; #define rep(i,n) for (int i = 0; i < (n); ++i) int main(){ string N; cin >> N; char max_num = '0'; int max_ix = 0; for(int i=0;i<N.length();i++){ if(max_num <= N[i]){ max_num = N[i]; max_ix = i; } } for(int i=0;i<N.length();i++){ if(max_num != N[i]){ swap(N[i],N[max_ix]); } } cout << N << endl; }