report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Yet another build array problem - FlandreOJ: Flandre Online Judge

Yet another build array problem

Time limit: 1000 ms
Memory limit: 256 MB
How many arrays $A$ of length $n$ consisting of non-negative integers do not exceed $k$ such that the sum of every 2 adjacent elements is a prime number? ### Input - The first line contains 2 integers $n, k$. ### Output - Print the number of satisfied array modulo $10^9+7$. ### Constraints - $1 \le n \le 100$ - $1 \le k \le 1000$. ### Example Input: ``` 2 2 ``` Output: ``` 5 ``` #### Note: There are $5$ arrays: $(0, 2), (1, 1), (1, 2), (2, 1), (2, 0)$.
Introduction to dynamic programming
Hakurei Shrine
Buying tickets
Reading 2
Longest increasing subsequence
Jealousy
Maximum path 2
Fences painting
Hall
Knapsack 2
Longest common subsequence
Yet another build array problem
Rectangle cutting
Palindrome query
Marisa
Merging elements
Brewing potion 8
Topic
Math
Dynamic Programming
Rating 1100
Solution (1) Solution