結果
| 問題 |
No.559 swapAB列
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2020-08-24 07:47:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 303 bytes |
| コンパイル時間 | 584 ms |
| コンパイル使用メモリ | 65,024 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-06 03:36:41 |
| 合計ジャッジ時間 | 1,207 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 2 WA * 5 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main(){
string S;
cin >> S;
int N = S.size();
int ans = 0;
for (int i = 0; i < N; i++){
for (int j = 0; j < N - 1; j++){
if (S[j] == 'b' && S[j + 1] == 'a'){
ans++;
swap(S[j], S[j + 1]);
}
}
}
cout << ans << endl;
}
SSRS