Back
Close

Matt's PS5

Statement

 Goal

Matt works as a programmer and wants to buy himself a ps5 for his birthday.

He is paid D dollars every 15th of the month, the ps5 cost X dollars, his birthday is in T days and it is currently the Uth day of the month. (for this exercise we assume that every month only contain 30 days)

Will Matt be able to buy a PS5 on his birthday ?
Input
A single line containing four integers separated by spaces:
D amount Matt gets paid every month
X cost of ps5
T number of days until Matt's birthday
U current date
Output
A single line, with true if he is able to buy the ps5, false if he won't be able to afford it, or ruined if he don't have any money.
Constraints
0 < D <= 10000
0 < X <= 1000
0 < T <= 364
0 < U <= 30
Example
Input
2000 500 120 10
Output
true

Game modes
Fastest, Shortest

Test cases
Easily buyable Test
Input
2000 500 120 10
Output
true

Easily buyable Validator
Input
2000 400 120 10
Output
true

Exact amount Test
Input
250 500 40 10
Output
true

Exact amount Validator
Input
200 400 40 10
Output
true

Price too high Test
Input
50 900 240 1
Output
false

Price too high Validator
Input
20 950 240 1
Output
false

Very low price and salary Test
Input
1 10 360 7
Output
true

Very low price and salary Validator
Input
2 20 360 6
Output
true

No Salary Test
Input
1000 150 5 2
Output
ruined

No Salary Validator
Input
6000 400 5 2
Output
ruined

Solution language

Solution

Stub generator input