Fibonacci Strings
시간 제한: 1000ms메모리 제한: 1024MB출처: Programmeringsolympiaden 2016 — katt3BOJ 21352
문제
Aron likes Fibonacci numbers. He likes them so much he actually got bored of the numbers themselves and decided to invent other combinatorial objects based on them instead.
His first invention is the Fibonacci string. We call a string consisting of only letters and , with exactly letters without any two consecutive letters a Fibonacci string of the :th order.
Given a string of :s and :s, compute the sum of orders of all Fibonacci strings that are substrings of . Note that if a string appears multiple times, its order should be counted once for every occurance.
입력
The sample judge reads input in the following format:
- line :
N - line :
X
출력
The judge writes a single line containing the return value of fibonacci(N, X).
예제
예제 1
입력
6 abaaba
출력
12
코드를 제출하려면 로그인하세요.