結果

問題 No.2201 p@$$w0rd
ユーザー siman
提出日時 2023-02-03 21:55:41
言語 Ruby
(3.4.1)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 581 bytes
コンパイル時間 47 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-07-02 19:48:54
合計ジャッジ時間 3,201 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

S = gets.chomp

def dfs(idx, str, has_char, has_num, has_symbol)
  cnt = 0

  if idx == str.size
    if has_char && has_num && has_symbol
      return 1
    else
      return 0
    end
  end

  case S[idx]
  when 'l'
    cnt += dfs(idx + 1, str, has_char, true, has_symbol)
  when 'o'
    cnt += dfs(idx + 1, str, has_char, true, has_symbol)
  when 'a'
    cnt += dfs(idx + 1, str, has_char, has_num, true)
  when 's'
    cnt += dfs(idx + 1, str, has_char, has_num, true)
  end

  cnt += dfs(idx + 1, str, true, has_num, has_symbol)

  cnt
end

puts dfs(0, S, false, false, false)
0