#SP0000221. Bức tường và số nguyên tố (Red John is Back)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Bức tường và số nguyên tố (Red John is Back)
Red John is Back
Source: HackerRank
Version: Phuoc Hung OJ Extended
Problem Statement
A wall consists of rows and columns of unit cells. You have unlimited bricks of size and , which may be placed vertically or horizontally to cover the wall without overlap or uncovered cells.
Let be the number of distinct complete tilings of the wall. Count prime numbers satisfying . Print the number of primes, not the number of tilings.
Input
The only line contains the integer , the length of the wall measured in unit-cell columns.
Output
Print a single integer: the number of primes not exceeding the tiling count .
Subtasks
-
Subtask 1 (20 points): .
-
Subtask 2 (30 points): .
-
Subtask 3 (50 points): .
Examples
Input
7
Output
3
Explanation
Lengths , and each have only one tiling, using vertical bricks. At length there are two: four vertical bricks or four horizontal bricks. This gives , , and . The primes not exceeding are , so the answer is .