info

MAPS OS v1.1.4 © 2025

Glory to the Segtree

Glory to the Algorithm.

Polygon/OrderGo home

Login to view input

no submission

Login to submit an answer

Problem Leaderboard

Problem Leaderboard

Polygon/Order

I ask of you, can you solve this?

A client who only has rectangular tiles with sides a by b wishes to build a rectangular floor where the ratio between the length and width is x by y. Tiles can be rotated, but all tiles should be oriented in the same direction. What is the minimum number of tiles they would need?

P.S. The client does not care about the area of the floor, but only the ratio. Given a b x y find the minimum number of tiles.

Sample input:

2 3 4 5

Sample output:

30