Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CinemaVoucher
- {
- class Program
- {
- static void Main(string[] args)
- {
- int voucher = int.Parse(Console.ReadLine());
- int ticket = 0;
- int other = 0;
- while (true)
- {
- string buy = Console.ReadLine();
- if (buy == "End")
- {
- break;
- }
- int price = 0;
- if (buy.Length > 8)
- {
- for (int i = 0; i < 2; i++)
- {
- price += buy[i];
- }
- if (voucher >= price)
- {
- voucher -= price;
- ticket++;
- }
- else
- {
- break;
- }
- }
- else
- {
- price = buy[0];
- if (voucher >= price)
- {
- voucher -= price;
- other++;
- }
- else
- {
- break;
- }
- }
- }
- Console.WriteLine(ticket);
- Console.WriteLine(other);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement