結果

問題 No.2201 p@$$w0rd
ユーザー zezero
提出日時 2023-02-03 21:44:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 997 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 88,620 KB
最終ジャッジ日時 2025-02-10 09:00:30
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

string s;
int digit = 0;
int az = 0;
int sym = 0;
int n;
int ans = 0;
void dfs(int idx){
  //cout << "index:" << idx << endl;
  if (idx == n){
    //cout << digit << " " << az << endl;
    if (digit > 0 && az > 0 && sym > 0){
      ans++;
    }
    return;
  }
  
  if (s[idx] == 'l' || s[idx] == 'o'){
    az++;
    dfs(idx+1);
    az--;
    digit++;
    dfs(idx+1);
    digit--;
  }
  else if (s[idx] == 'a' || s[idx] == 's'){
    az++;
    dfs(idx+1);
    az--;
    sym++;
    dfs(idx+1);
    sym--;
  }
  else{
    az++;
    dfs(idx+1);
    az--;
  }
  return;
}

void solve(){
  cin >> s;
  n = s.size();
  //cout << n << endl;
  dfs(0);
  cout << ans << endl;
  
}

  

int main(){
  int tt = 1;
  //cin >> tt;
  while(tt--){
	  solve();
  }
  return 0;
}
0