結果

問題 No.52 よくある文字列の問題
ユーザー ゆるく
提出日時 2015-02-22 20:11:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 531 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,904 KB
最終ジャッジ日時 2024-09-22 05:19:37
合計ジャッジ時間 1,162 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

memo = defaultdict(int)
s = input()
sn = len(s)
count = 0
def solve(a,b):
  global count
  if a == "":
    if b == "aaa":
      print(b)
      sys.exit(0)
    if not memo[b]:
      count += 1
      memo[b] = True
    return
  l = len(a)
  solve(a[1:l], b + a[0])
  solve(a[0:l - 1], b + a[l - 1])
solve(s, "")
print(count)
0