PYTHON PROGRAM- SURVIVE | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

PYTHON PROGRAM- SURVIVE

You are a poor person in an island. There is only one shop in this island, this shop is open on all days of the week except for Sunday. Consider following constraints: N – Maximum unit of food you can buy each day. S – Number of days you are required to survive. M – Unit of food required each day to survive. Currently, it’s Monday, and you need to survive for the next S days.  Find the minimum number of days (ceil value) on which you need to buy food from the shop so that you can survive the next S days, or determine that it isn’t possible to survive. Input Format: The first line of the input contains three numbers S, N and M separated by space. Output Format: If it is possible to survive the print the number of days, otherwise print 'NO' without quotes. Example-1 Input: 10 16 2 Output: 2 Example-2 Input: 10 20 30 Output: NO

23rd Sep 2018, 5:00 AM
Krishnanshu Dey
Krishnanshu Dey - avatar
3 Answers
+ 2
Then, what you asking?
23rd Sep 2018, 7:24 AM
KrOW
KrOW - avatar
+ 1
what should be the exact code. Can u solved this??
23rd Sep 2018, 8:29 AM
Krishnanshu Dey
Krishnanshu Dey - avatar
+ 1
Its not an hard problem (it require only few basic math operations)... Anyway i dont post solutions to problem that seem assignements... Where you blocked? Can you post your code?
23rd Sep 2018, 8:47 AM
KrOW
KrOW - avatar