Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

PIZZA Problem

Limits 1s, 512 MB

Faiza, Afia and Tashfiah, are close friends. They got chance in BRAC University CSE Department together. Today, they are going to Dhaka from Chittagong for admission. They are so excited that they arrived at station exactly T minutes before the reported time. Now, they are feeling so bored to wait at the station for a long time and they don’t want to do it. Tashfiah, as a pizza lover, proposed others to go to the near ‘The Pizza Park’ which is very well known for a special Giant (largest) Pizza. Faiza and Afia both agreed, but as a conscious girl, Afia wants to know if it’s possible for them to get back before the train comes. If it’s impossible, then obviously it is not a wise decision to go to have a pizza. For this reason, Afia is not interested to take the risk and also she can’t break her close friend’s heart. On the other hand, Afia is so chill this moment and she doesn’t want to go for the calculation. So, your task is to help Afia to determine whether they can go for pizza or not.

As already mentioned, it’s a giant size pizza, so it takes exactly X minutes to finish by Faiza herself, Y minutes for Afia and Z minutes for Tashfiah. Moreover, this shop takes exactly M minutes to serve a pizza. And remember, they will order only one pizza as it is already a Giant one.


Input takes five integers, T, X, Y, Z and M, that already defined above. (0 ≤ T, X, Y, Z, M ≤ 104)


Print “YES” (without quotes), if it is possible to get back for them before the train arrived, “NO” (without quotes) otherwise.


2 3 3 3 1
2 2 3 4 1
2 4 4 4 1



    88% Solution Ratio

    fire_tornadoEarliest, Jul '19

    fire_tornadoFastest, 0.0s

    user.4mbr2ubzLightest, 0 B

    touhidurrrShortest, 69B


    Login to submit


    Use unitary method to determine how much time needed to finish a pizza by all together. inner calcu...

    Toph uses cookies. By continuing you agree to our Cookie Policy.