結果

問題 No.2021 Not A but B
ユーザー shoshoshom
提出日時 2022-07-29 21:33:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
MLE  
実行時間 -
コード長 410 bytes
コンパイル時間 1,899 ms
コンパイル使用メモリ 199,120 KB
最終ジャッジ日時 2025-01-30 14:59:23
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 9 TLE * 1 MLE * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

static inline void solution() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  set<string> st;
  for (int i = 0; i < n - 1; i++) {
    char a = s[i], b = s[i + 1];
    s[i] = 'B', s[i + 1] = 'B';
    st.insert(s);
    s[i] = a, s[i + 1] = b;
  }
  cout << st.size() << '\n';
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  solution();
  return 0;
}
0