結果
| 問題 |
No.559 swapAB列
|
| コンテスト | |
| ユーザー |
newlife171128
|
| 提出日時 | 2017-12-17 02:48:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 667 bytes |
| コンパイル時間 | 1,634 ms |
| コンパイル使用メモリ | 85,088 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-14 23:05:26 |
| 合計ジャッジ時間 | 2,235 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
ソースコード
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include<sstream>
#include <queue>
#include <limits>
#include <cstdlib>
#include <deque>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
int main() {
string s;
cin>>s;
int len = s.length();
bool judge = true;
string tmp;
int count =0;
while(judge){
judge =false;
for(int k = 0 ; k <len-1; k++){
if(s[k] > s[k+1]){
tmp = s[k];
s.replace(k,1,s.substr(k+1,1));
s.replace(k+1,1 ,tmp);
count++;
judge = true;
}
}
}
/*cout<<s<<endl;*/
cout<<count<<endl;
return 0;
}
newlife171128