Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace ObjectsAndClasses
- {
- class Program
- {
- //ASDA% 50
- //DaS@!%$$ 10
- //$$ 10
- static void Main(string[] args)
- {
- int[] prices = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int goldPrice = prices[1];
- int jewelsPrice = prices[0];
- long goldIncome = 0;
- long jewelsIncome = 0;
- long goldExpenses = 0;
- long jewelsExpense = 0;
- string input;
- while ((input = Console.ReadLine()) != "Jail Time")
- {
- string[] tokens = input.Split().ToArray();
- char[] data = tokens[0].ToCharArray();
- long expense = long.Parse(tokens[1]);
- for (int i = 0; i < data.Length; i++)
- {
- if(data[i] == '$')
- {
- goldIncome += goldPrice;
- goldExpenses += expense;
- }
- if(data[i] == '%')
- {
- jewelsIncome += jewelsPrice;
- jewelsExpense += expense;
- }
- }
- }
- long totalIncome = goldIncome + jewelsIncome;
- long totalExpense = goldExpenses + jewelsExpense;
- if(totalIncome >= totalExpense)
- {
- long result = totalIncome - totalExpense;
- Console.WriteLine("Heists will continue. Total earnings: {0}.", result);
- }
- else
- {
- long result = totalExpense - totalIncome;
- Console.WriteLine("Have to find another job. Lost: {0}.", result);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement