結果
| 問題 |
No.39 桁の数字を入れ替え
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-08-10 07:19:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 410 bytes |
| コンパイル時間 | 741 ms |
| コンパイル使用メモリ | 56,156 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-07 08:25:22 |
| 合計ジャッジ時間 | 1,511 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 8 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main(){
string n;
cin>>n;
int a,b,p;
a=0;
p=0;
for(int i=0; i<n.size(); ++i){
b=n[i]-'0';
if(a<=b){
a=b;
p=i;
}
}
if(p!=0){
char c;
c=n[p];
n.insert(n.begin(),c);
c=n[1];
n.insert(n.begin()+p+1,c);
n.erase(n.begin()+1);
n.erase(n.begin()+p+1);
}
cout<<n<<endl;
return 0;
}