Прости проверки, задача 22. Реколта
Помощ! :)
Дава ми 2 грешни проверки (80/100) , но не показва каква е грешката: https://pastebin.com/wTHdQ6Bb
Помощ! :)
Дава ми 2 грешни проверки (80/100) , но не показва каква е грешката: https://pastebin.com/wTHdQ6Bb
Мисля, че рано правиш закръгления. Може да погледнеш този код:
https://pastebin.com/7Q9c5MXs
мога да ти помогна донякъде, защото в момента уча Java, но 90/100 докарва като въведеш случай, в който произведеното вино е равно на нужното:
if (needWine <= totalWine)
Благодаря, тъкмо го бях направила , остава да се сетя и за другото. :))
мисля, че това авторско решение е на C# : https://judge.softuni.bg/Contests/Practice/Index/233#1
Здравей,
Ето моето решение на задачата.
Поздрави
import java.util.Scanner;
public class WineGrapeHarvest {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
double vineyardSqM = Double.parseDouble(console.nextLine());
double harvestedGrapesBySqM = Double.parseDouble(console.nextLine());
double necessaryLitersWineProduction = Double.parseDouble(console.nextLine());
int numberOfWorkers = Integer.parseInt(console.nextLine());
double harvest = vineyardSqM * harvestedGrapesBySqM;
harvest *= 0.40;
double producedLitersOfWine = harvest / 2.50;
if (producedLitersOfWine >= necessaryLitersWineProduction) {
System.out.printf("Good harvest this year! Total wine: " +
"%d liters.%n", (int)Math.floor(producedLitersOfWine));
System.out.printf("%d liters left -> %d liters per person.",
(int)Math.ceil(producedLitersOfWine - necessaryLitersWineProduction),
(int)Math.ceil((producedLitersOfWine - necessaryLitersWineProduction)
/ numberOfWorkers));
} else {
System.out.printf("It will be a tough winter! More " +
"%d liters wine needed.",
(int)Math.floor(necessaryLitersWineProduction - producedLitersOfWine));
}
}
}