Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int days = Integer.parseInt(scanner.nextLine());
- double availableFood = Double.parseDouble(scanner.nextLine()),
- deer1 = Double.parseDouble(scanner.nextLine()),
- deer2 = Double.parseDouble(scanner.nextLine()),
- deer3 = Double.parseDouble(scanner.nextLine());
- availableFood -= (deer1 + deer2 + deer3) * days;
- if (availableFood >= 0) {
- System.out.println(Math.floor(availableFood) + " kilos of food left.");
- } else {
- System.out.println(Math.ceil(Math.abs(availableFood)) + " more kilos of food are needed.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement