Проблем със задача от минал изпит.
Здравейте,
Подготвям се за изпитът Programming Basics и се сблъсках една задача от " Programming Basics Exam - 21 February 2016 : Problem 01 - Hungry Garfield''.При втория нулев тест ми изкарва 113.55 а в judge 13.55.
using System;
namespace garfieldProblem
{
class Program
{
static void Main(string[] args)
{
int moneyFromJohn = int.Parse(Console.ReadLine());
double moneyExchange = double.Parse(Console.ReadLine());
int pizzaPrice = int.Parse(Console.ReadLine());
int lasagnaPrice = int.Parse(Console.ReadLine());
int sandwichPrice = int.Parse(Console.ReadLine());
int pizzaQuantity = int.Parse(Console.ReadLine());
int lasagnaQuantity = int.Parse(Console.ReadLine());
int sandwichQuantity = int.Parse(Console.ReadLine());
double moneyNeeded = pizzaPrice / moneyExchange * pizzaQuantity + lasagnaPrice / moneyExchange* lasagnaQuantity + sandwichPrice / moneyExchange* sandwichQuantity ;
double moneyLeft = moneyFromJohn - moneyNeeded;
if (moneyFromJohn >= moneyNeeded )
{
Console.WriteLine("Garfield is well fed, John is awesome. Money left: ${0:f2}.", moneyLeft );
}
else
{
Console.WriteLine("Garfield is hungry. John is a badass. Money needed: ${0:f2}." , moneyNeeded);
}
}