結果
| 問題 |
No.256 桁の数字を入れ替え (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-07-31 23:05:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 654 bytes |
| コンパイル時間 | 742 ms |
| コンパイル使用メモリ | 68,316 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-17 23:22:41 |
| 合計ジャッジ時間 | 1,080 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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(){
int N;
string S;
cin >> S;
vector<char> v;
for(int i = 0; i< S.size(); i++)
v.push_back(S[i]);
int count = 0;
vector<char>::iterator it = v.begin();
while(count < 2 and it != v.end()){
auto m = max_element(it, v.end());
if(it != m){
swap(*it, *m);
count ++;
}
it++;
}
for(int i=0 ;i < v.size(); i++)
cout << v[i];
cout << endl;
return 0;
}