#C10855. Shelf Fulfillment Challenge

    ID: 40106 Type: Default 1000ms 256MiB

Shelf Fulfillment Challenge

Shelf Fulfillment Challenge

You are given a shelf of length \(L\) and two types of books with lengths \(a\) and \(b\). The task is to determine whether it is possible to completely fill the shelf using some non-negative integer number of each type of book, such that the total length exactly equals \(L\).

Formally, you need to check if there exist non-negative integers \(i\) and \(j\) such that:

[ i \times a + j \times b = L ]

with the condition that \(L > 0\), \(a > 0\), and \(b > 0\). If such a combination exists, output "Perfect fit!"; otherwise, output "Can't fit perfectly!". Use a tolerance of \(10^{-9}\) when comparing floating-point sums.

inputFormat

The input consists of a single line containing three space-separated floating-point numbers:

  • \(L\): the length of the shelf.
  • \(a\): the length of the first type of book.
  • \(b\): the length of the second type of book.

It is guaranteed that all values are positive numbers.

outputFormat

Output a single line to standard output. If it is possible to exactly fill the shelf using books of lengths \(a\) and \(b\), print "Perfect fit!". Otherwise, print "Can't fit perfectly!"

## sample
10.0 3.0 7.0
Perfect fit!

</p>