10*Match Tickets
Задачата ми тръгна 100/100 :) и пак да питам как се тества ред по ред задачата. Искам да видя как кода се обработва от компа. Ще бъде много по лесно при намиране на грешки друг път.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace match_tickets
{
class Program
{
static void Main(string[] args)
{
double balance = double.Parse(Console.ReadLine());
string category = Console.ReadLine().ToLower();
int number = int.Parse(Console.ReadLine());
if (1000 <= balance && balance <= 1000000 && (category == "vip" || category == "normal") && number >= 1 && number <= 200)
{
if (number >= 1 && number <= 4 && category == "normal")
{
double transport = balance * 0.75;
double money = balance - transport;
if (money <= number * 249.99)
{
double number1 = (number * 249.99) - money;
Console.WriteLine("Not enough money! You need {0:F2} leva.", number1);
}
else
{
double number2 = money - (number * 249.99);
Console.WriteLine("Yes! You have {0:F2} leva left.", number2);
}
}
else if (number >= 5 && number <= 9 && category == "normal")
{
double transport = balance * 0.60;
double money = balance - transport;
if (money <= number * 249.99)
{
double number1 = (number * 249.99) - money;
Console.WriteLine("Not enough money! You need {0:F2} leva.", number1);
}
else
{
double number2 = money - (number * 249.99);
Console.WriteLine("Yes! You have {0:F2} leva left.", number2);
}
}
else if (number >= 10 && number <= 24 && category == "normal")
{
double transport = balance * 0.50;
double money = balance - transport;
if (money <= number * 249.99)
{
double number1 = (number * 249.99) - money;
Console.WriteLine("Not enough money! You need {0:F2} leva.", number1);
}
else
{
double number2 = money - (number * 249.99);
Console.WriteLine("Yes! You have {0:F2} leva left.", number2);
}
}
else if (number >= 25 && number <= 49 && category == "normal")
{
double transport = balance * 0.40;
double money = balance - transport;
if (money <= number * 249.99)
{
double number1 = (number * 249.99) - money;
Console.WriteLine("Not enough money! You need {0:F2} leva.", number1);
}
else
{
double number2 = money - (number * 249.99);
Console.WriteLine("Yes! You have {0:F2} leva left.", number2);
}
}
else if (number >= 50 && category == "normal")
{
double transport = balance * 0.25;
double money = balance - transport;
if (money <= number * 249.99)
{
double number1 = (number * 249.99) - money;
Console.WriteLine("Not enough money! You need {0:F2} leva.", number1);
}
else
{
double number2 = money - (number * 249.99);
Console.WriteLine("Yes! You have {0:F2} leva left.", number2);
}
}
else if (number >= 1 && number <= 4 && category == "vip")
{
double transport = balance * 0.75;
double money = balance - transport;
if (money <= number * 499.99)
{
double number1 = (number * 499.99) - money;
Console.WriteLine("Not enough money! You need {0:F2} leva.", number1);
}
else
{
double number2 = money - (number * 499.99);
Console.WriteLine("Yes! You have {0:F2} leva left.", number2);
}
}
else if (number >= 5 && number <= 9 && category == "vip")
{
double transport = balance * 0.60;
double money = balance - transport;
if (money <= number * 499.99)
{
double number1 = (number * 499.99) - money;
Console.WriteLine("Not enough money! You need {0:F2} leva.", number1);
}
else
{
double number2 = money - (number * 499.99);
Console.WriteLine("Yes! You have {0:F2} leva left.", number2);
}
}
else if (number >= 10 && number <= 24 && category == "vip")
{
double transport = balance * 0.50;
double money = balance - transport;
if (money <= number * 499.99)
{
double number1 = (number * 499.99) - money;
Console.WriteLine("Not enough money! You need {0:F2} leva.", number1);
}
else
{
double number2 = money - (number * 499.99);
Console.WriteLine("Yes! You have {0:F2} leva left.", number2);
}
}
else if (number >= 25 && number <= 49 && category == "vip")
{
double transport = balance * 0.40;
double money = balance - transport;
if (money <= number * 499.99)
{
double number1 = (number * 499.99) - money;
Console.WriteLine("Not enough money! You need {0:F2} leva.", number1);
}
else
{
double number2 = money - (number * 499.99);
Console.WriteLine("Yes! You have {0:F2} leva left.", number2);
}
}
else if (number >= 50 && category == "vip")
{
double transport = balance * 0.25;
double money = balance - transport;
if (money <= number * 499.99)
{
double number1 = (number * 499.99) - money;
Console.WriteLine("Not enough money! You need {0:F2} leva.", number1);
}
else
{
double number2 = money - (number * 499.99);
Console.WriteLine("Yes! You have {0:F2} leva left.", number2);
}
}
}
}
}
}