Loading...
+ Нов въпрос
EirikTorpedo 0 Точки

## Cinema Tickets - Judge дава 0 точки на решена задача

using System;

namespace CinemaTickets
{
class Program
{
static void Main(string[] args)
{
int sudentTikets = 0;
int standartTikets = 0;
int kidTikets = 0;
while (true) // movies
{
int movieTikets = 0;
string movieName = Console.ReadLine();
int movieSeats = int.Parse(Console.ReadLine());
while (true) // tikets
{
string tiket = Console.ReadLine();
switch (tiket)
{
case "student":
movieTikets++;
sudentTikets++;
break;
case "standard":
movieTikets++;
standartTikets++;
break;
case "kid":
movieTikets++;
kidTikets++;
break;
}
if (tiket == "End")
{
Console.WriteLine(\$"{movieName} - {((double)movieTikets / movieSeats * 100):F2}% full.");
break;
}
if (tiket == "Finish")
{
Console.WriteLine(\$"{movieName} - {((double)movieTikets / movieSeats * 100):F2}% full.");

int allTikets = sudentTikets + standartTikets + kidTikets;
Console.WriteLine(\$"Total tickets: {allTikets}");
Console.WriteLine(\$"{((double)sudentTikets / allTikets * 100):F2}% student tickets.");
Console.WriteLine(\$"{((double)standartTikets / allTikets * 100):F2}% standard tickets.");
Console.WriteLine(\$"{((double)kidTikets / allTikets * 100):F2}% kids tickets.");
return;
}
}
}
}
}
}

Тагове:
0
Borislav_Vulkov 54 Точки

Здравей,
можеш ли да дадеш условието на задачата ?

0
kkaraivanov 330 Точки

Заповядай, сравни грешките.

string command = "";
int totalStudent = 0;
int totalStandard = 0;
int totalKid = 0;
int totalTiket = 0;
while (command != "Finish")
{
command = Console.ReadLine();
int student = 0;
int standard = 0;
int kid = 0;
if (command == "Finish")
{
break;
}
int freePosition = int.Parse(Console.ReadLine());
for (int i = 0; i < freePosition; i++)
{
string curentPosition = Console.ReadLine();
if (curentPosition == "student")
{
student++;
}
else if (curentPosition == "standard")
{
standard++;
}
else if (curentPosition == "kid")
{
kid++;
}
else if (curentPosition == "End")
{
break;
}
}
totalStudent += student;
totalStandard += standard;
totalKid += kid;
Console.WriteLine(\$"{command} - {((student + standard + kid) / (double)freePosition) * 100:f2}% full.");
}
totalTiket = totalStudent + totalStandard + totalKid;
Console.WriteLine(\$"Total tickets: {totalTiket}");
Console.WriteLine(\$"{(totalStudent / (double)totalTiket) * 100:f2}% student tickets.");
Console.WriteLine(\$"{(totalStandard / (double)totalTiket) * 100:f2}% standard tickets.");
Console.WriteLine(\$"{(totalKid / (double)totalTiket) * 100:f2}% kids tickets.");

0
EirikTorpedo 0 Точки

Благодаря!

0