結果
| 問題 |
No.256 桁の数字を入れ替え (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-07-31 22:33:26 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 766 bytes |
| コンパイル時間 | 631 ms |
| コンパイル使用メモリ | 68,420 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-17 23:13:55 |
| 合計ジャッジ時間 | 979 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 2 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
int main(){
//vector<int> v;
int N;
string S;
cin >> S;
/*
i) v.push_back(0);
else{
while(N > 0){
v.push_back(N%10);
N /= 10;
}
v.reverse();
}
*/
vector<char> v;
for(int i = 0; i< S.size(); i++)
v.push_back(S[i]);
auto it = max_element(v.begin(), v.end());
swap(*it, v[0]);
if(v.size() > 1){
auto jt = max_element(v.begin()+1, v.end());
swap(*jt, v[1]);
}
for(int i=0 ;i < v.size(); i++)
cout << v[i];
cout << endl;
return 0;
}