Проблем със задача Foot for Pets от Exam 28-29 March 2020
Здравейте колеги,
тази задача ми дава всички верни отговори на условията, обаче в judge ми дава 66/100 ?
Немога да разбера каде има проблем, не ми показва грешката от каде идва, като дебъгвам всичко се смята правилно.
Ето го и моя код:
package com.company;
import java.util.Scanner;
public class FoodForPets {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
double days = Integer.parseInt(scan.nextLine());
double food = Double.parseDouble(scan.nextLine());
double dogFood = 0;
double sumDogFood = 0;
double catFood = 0;
double sumCatFood = 0;
double biscuits = 0;
double sumFood = 0;
for (int i = 1; i <= days; i++){
dogFood = Integer.parseInt(scan.nextLine());
catFood = Integer.parseInt(scan.nextLine());
sumDogFood = sumDogFood +dogFood;
sumCatFood = sumCatFood +catFood;
sumFood = sumFood+(dogFood+catFood);
if (i == 3){
biscuits = (dogFood+catFood)*0.1;
}
}
sumDogFood = (sumDogFood/sumFood)*100;
sumCatFood = (sumCatFood/sumFood)*100;
sumFood = (sumFood/food)*100;
System.out.printf("Total eaten biscuits: %.0fgr.%n",biscuits);
System.out.printf("%.2f%% of the food has been eaten.%n", sumFood);
System.out.printf("%.2f%% eaten from the dog.%n",sumDogFood);
System.out.printf("%.2f%% eaten from the cat.%n",sumCatFood);
}
}