Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _4_cinemaNight
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double voucher = double.Parse(Console.ReadLine());
  14. string itemType = Console.ReadLine();
  15. double itemPrice = 0;
  16. int counterMovie = 0;
  17. int counterOthers = 0;
  18.  
  19. while (itemType != "End" && voucher >= 0)
  20.  
  21. {
  22.  
  23. if (itemType.Length > 8)
  24. {
  25. for (int i = 0; i < 2; i++)
  26. {
  27. int count = itemType[i];
  28. itemPrice += count;
  29.  
  30. }
  31. if (itemPrice > voucher)
  32. {
  33. voucher -= itemPrice;
  34. break;
  35. }
  36. voucher -= itemPrice;
  37. counterMovie++;
  38.  
  39.  
  40. }
  41. if (itemType.Length <= 8)
  42. {
  43. for (int i = 0; i < 1; i++)
  44. {
  45. int count = itemType[i];
  46. itemPrice = count;
  47. if (itemPrice > voucher)
  48. {
  49. voucher -= itemPrice;
  50. break;
  51. }
  52. voucher -= itemPrice;
  53. counterOthers++;
  54.  
  55.  
  56. }
  57.  
  58. }
  59.  
  60. if (voucher < 0)
  61. { break; }
  62.  
  63. itemType = Console.ReadLine();
  64. }
  65.  
  66. Console.WriteLine($"{counterMovie}" );
  67. Console.WriteLine($"{counterOthers}");
  68.  
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement