- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Program to find out number of blocks that can be covered in Python

Suppose there are n blocks in a path, and a worker is putting colored tiles on the blocks. The worker is putting blocks in a way, such that if a block number in the path is divisible by 4 or/and 2 but not 42, he puts a colored tile there. We have to find out the number of blocks he can cover if he has started with k number of colored tiles.

So, if the input is like k = 16, then the output will be 32.

To solve this, we will follow these steps −

- MOD = 10^9 + 7
- quotient := floor value of (k / 20)
- remainder := k mod 20
- if remainder is same as 0, then
- return((42 * quotient - 2) mod MOD)

- otherwise,
- return((42 * quotient + 2 * remainder) mod MOD)

## Example

Let us see the following implementation to get better understanding −

def solve(k): MOD = 10**9 + 7 quotient = k // 20 remainder = k % 20 if remainder == 0: return ((42 * quotient - 2) % MOD) else: return ((42 * quotient + 2 * remainder) % MOD) print(solve(16))

## Input

16

## Output

32

- Related Questions & Answers
- C++ program to find out the maximum number of cells that can be illuminated
- C++ program to find out the number of coordinate pairs that can be made
- Problem to Find Out the Maximum Number of Coins that Can be Collected in Python
- Program to find minimum distance that needs to be covered to meet all person in Python
- Python Program to find out the number of rooms in which a prize can be hidden
- C++ Program to find out the number of unique matrices that can be generated by swapping rows and columns
- C++ code to find out which number can be greater
- Program to find out how many transfer requests can be satisfied in Python
- Program to find maximum number of package that can be bought by buyers in C++
- Program to count how many blocks are covered k times by walking in Python
- C++ Program to find out the maximum amount of score that can be decreased from a graph
- C++ Program to find out the maximum amount of money that can be made from selling cars
- C++ Program to find out the maximum amount of profit that can be achieved from selling wheat
- C++ program to find out the number of ways a grid with boards can be colored
- Program to find out the number of boxes to be put into the godown in Python

Advertisements