Integer29. Given positive integers A, B, and C. On a rectangle of size \ (A \ times B \) the maximum possible number of squares with side C (without overlays) is placed. Find the number of squares placed on the rectangle, as well as the area of the unoccupied part of the rectangle.

Solution in Python 3:

import numpy as np
import random

A,B = list(np.random.choice(range(1, 16), 2))
C = random.randint(1,min(A,B))
print("A = {0}, B = {1}, C = {2}".format(A,B,C))

a = int(A/C)
b = int(B/C)

print("Area of the rectangle:",A*B)
print("Area of the square:",C*C)
print("Number of squares on the rectangle:",a*b)
print("Area of the unoccupied part:",A*B - a*b*C*C)