#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

//You can change these numbers here to change the program:
const int MIN_FOOD = 20;
const float POISION_CHANCE = 0.04;



int main(){
	float cur_food, food_restoration, end_food, servings_needed;
	

	cout << "What is the value of your food meter currently?" << endl;
	cin >> cur_food;

	cout << "How much max stamina does food restore?" << endl;
	cin >> food_restoration;

	cout << "What level of food meter would you like to end up with?"<< endl;
	cin >> end_food;



	servings_needed = (
		log(1 - POISION_CHANCE*(cur_food - MIN_FOOD)/food_restoration) -
		log(1 - POISION_CHANCE*(end_food - MIN_FOOD)/food_restoration)
	) / POISION_CHANCE;


	cout <<	"Assuming your food meter can't go below " << MIN_FOOD << " and the food has a " 
		<< POISION_CHANCE*100 << "% chance of food poision, you will have to eat the food an average " 
		<< "of " << servings_needed << " times." << endl;

	cout << "Without food poisioning, you'd only need to eat " << (end_food - cur_food)/food_restoration <<
		" times.\n" ;

	return 0;
}

