Submit | All submissions | Best solutions | Back to list |
HMBY - Hablu Wants to Buy |
In Hablu's country, there are 5 types of notes. $2, $4, $8, $16 and $32. He went to a shop, and wants to buy an item which costs $w. He has to pay exactly $w to the shopkeeper. Can he pay $w?
Hablu can break his notes in half, that is, he can break his one $32 notes to two $16 notes, a $16 can be broken into two $8 notes, and so on. Only $2 can't be broken into $1, because there are no $1 notes. He has A $2 notes, B $4 notes, C $8 notes, D $16 notes and E $32 notes. Your task is to find whether Hablu can pay $w using his notes.
Input
The first and only line contains positive integers A, B, C, D, E, w, separated by spaces.
Output
If Hablu can pay $w, print "YES", else print "NO".
Example
Input: 1 2 3 4 5 2 Output: YES
Constraints
(A+B+C+D+E) ≤ 109
w ≤ 107
Added by: | Ruhan Habib |
Date: | 2015-11-05 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |
Resource: | Own Problem |
hide comments
|
|||||
2019-01-23 13:28:12
don't waste your time to solve this problem |
|||||
2017-06-08 17:14:56
easy...just think a bit |
|||||
2017-01-21 08:57:31
Easiest problem on SPOJ that I've ever seen, hands down! |
|||||
2016-07-07 14:13:37
"Yes" and "No" costed me 1 WA! easy one , 150th :) |
|||||
2016-07-03 11:48:22
easy once..ac in one go!!!! |
|||||
2016-06-19 14:45:15
Easy question...direct logic. |
|||||
2016-04-02 12:32:06
easy tebra |
|||||
2016-02-26 18:15:22
easiest que on spoj.. |
|||||
2015-12-20 17:25:13 hanstan
My 70th :3 Easy one XD |
|||||
2015-11-14 06:33:12 Nilutpal Borgohain
can you check my solution , I think it should have given ac :( update : ok! its done :) Last edit: 2015-11-14 06:40:25 |