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 MasterHerbalist
- {
- class Program
- {
- static void Main(string[] args)
- {
- decimal dExpenses = decimal.Parse(Console.ReadLine());
- string input = Console.ReadLine();
- int days = 0;
- decimal moneymade = 0;
- while (input != "Season Over")
- {
- string[] day = input.Split();
- int hours = int.Parse(day[0]);
- string path = day[1];
- decimal price = decimal.Parse(day[2]);
- days++;
- for (int i = 0; i < hours; i++)
- {
- char currHerb = path[i];
- if (currHerb == 'H')
- {
- moneymade += price;
- }
- if (i == path.Length-1)
- {
- i = -1;
- hours = hours - path.Length;
- }
- }
- input = Console.ReadLine();
- }
- if(moneymade/days>=dExpenses)
- {
- Console.WriteLine("Times are good. Extra money per day: {0:F2}.",Math.Abs(moneymade/2 - dExpenses));
- }
- else
- {
- Console.WriteLine("We are in the red. Money needed: {0}.",(dExpenses*days)-moneymade);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement