Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- const double VINEYARD_AREA_PERGENTAGE = 0.4;
- const double GRAPES_IN_KILOGRAMS_PER_LITER_OF_WINE = 2.5;
- int areaInSquareMetres;
- cin >> areaInSquareMetres;
- double amountOfGrapesPerSquareMeter;
- cin >> amountOfGrapesPerSquareMeter;
- int requiredAmountOfWineInLiters, numberOfWorkers;
- cin >> requiredAmountOfWineInLiters >> numberOfWorkers;
- double totalWine = areaInSquareMetres * VINEYARD_AREA_PERGENTAGE * amountOfGrapesPerSquareMeter / GRAPES_IN_KILOGRAMS_PER_LITER_OF_WINE;
- double diff = totalWine - requiredAmountOfWineInLiters;
- if (diff < 0) {
- cout << "It will be a tough winter! More " << floor(abs(diff)) << " liters wine needed." << endl;
- }
- else {
- cout << "Good harvest this year! Total wine: " << floor(totalWine) << " liters." << endl;
- cout << ceil(diff) << " liters left -> " << ceil(diff / numberOfWorkers) << " liters per person." << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement