Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _4_cinemaNight
- {
- class Program
- {
- static void Main(string[] args)
- {
- double voucher = double.Parse(Console.ReadLine());
- string itemType = Console.ReadLine();
- double itemPrice = 0;
- int counterMovie = 0;
- int counterOthers = 0;
- while (itemType != "End" && voucher >= 0)
- {
- if (itemType.Length > 8)
- {
- for (int i = 0; i < 2; i++)
- {
- int count = itemType[i];
- itemPrice += count;
- }
- if (itemPrice > voucher)
- {
- voucher -= itemPrice;
- break;
- }
- voucher -= itemPrice;
- counterMovie++;
- }
- if (itemType.Length <= 8)
- {
- for (int i = 0; i < 1; i++)
- {
- int count = itemType[i];
- itemPrice = count;
- if (itemPrice > voucher)
- {
- voucher -= itemPrice;
- break;
- }
- voucher -= itemPrice;
- counterOthers++;
- }
- }
- if (voucher < 0)
- { break; }
- itemType = Console.ReadLine();
- }
- Console.WriteLine($"{counterMovie}" );
- Console.WriteLine($"{counterOthers}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement