Vegetable Market-два теста ми гърмят
Здравейте! Странното е, че в условието на задачата пише: "Ограничения: Всички числа ще са в интервала от 0.00 до 1000.00" и при включване на тези проверки ми дава 80/100 точки и грешки в Test #2 (Incorrect answer),Test #6 (Incorrect answer), а ако ги махна тези проверки 90/100 и само грешка Test #2 (Incorrect answer).Защо?
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
double PricePerKilogramVegetables;
double PricePerKilogramFruit;
int TotalKilogramsVegetables;
int TotalKilogramsFruit;
double price = 0;
cin >> PricePerKilogramVegetables;
cin >> PricePerKilogramFruit;
cin >> TotalKilogramsVegetables;
cin >> TotalKilogramsFruit;
if ((PricePerKilogramVegetables <= 1000) && (TotalKilogramsVegetables <= 1000)
&& (PricePerKilogramVegetables >= 0) && (TotalKilogramsVegetables >= 0)
&& (PricePerKilogramFruit <= 1000) && (TotalKilogramsFruit <= 1000)
&& (PricePerKilogramFruit >= 0) && (TotalKilogramsFruit >=0)) {
if ((PricePerKilogramVegetables != 0) && (TotalKilogramsVegetables != 0)){
price = PricePerKilogramVegetables * TotalKilogramsVegetables;
}
if ((PricePerKilogramFruit != 0) && (TotalKilogramsFruit != 0)){
price = price + (PricePerKilogramFruit * TotalKilogramsFruit);
cout << setprecision(15) << price / 1.94 << endl;
}
else if ((PricePerKilogramVegetables != 0) && (TotalKilogramsVegetables != 0)
||(PricePerKilogramFruit != 0) && (TotalKilogramsFruit != 0)){
cout << setprecision(15) << price / 1.94 << endl;
}
}
return 0;
}