Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace izpit.podgotve
- {
- class Program
- {
- static void Main(string[] args)
- {
- double roomCapacity = double.Parse(Console.ReadLine());
- string input = Console.ReadLine();
- int counter = 0;
- double cinemaIncome = 0;
- double totalCount = 0;
- while (input != "Movie time!" || counter >= roomCapacity)
- {
- counter = int.Parse(input);
- if (totalCount + counter > roomCapacity)
- {
- totalCount += counter;
- break;
- }
- if (counter % 3 == 0)
- {
- cinemaIncome += (counter * 5) - 5;
- }
- else
- {
- cinemaIncome += counter * 5;
- }
- totalCount += counter;
- if (totalCount > roomCapacity)
- {
- break;
- }
- input = Console.ReadLine();
- }
- if (totalCount <= roomCapacity)
- {
- Console.WriteLine($"There are {roomCapacity - totalCount} seats left in the cinema.");
- Console.WriteLine($"Cinema income - {cinemaIncome} lv.");
- return;
- }
- else if (totalCount >= roomCapacity)
- {
- Console.WriteLine("The cinema is full.");
- Console.WriteLine($"Cinema income - {cinemaIncome} lv.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement