Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 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 MasterHerbalist
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. decimal dExpenses = decimal.Parse(Console.ReadLine());
  14. string input = Console.ReadLine();
  15. int days = 0;
  16. decimal moneymade = 0;
  17. while (input != "Season Over")
  18. {
  19. string[] day = input.Split();
  20. int hours = int.Parse(day[0]);
  21. string path = day[1];
  22. decimal price = decimal.Parse(day[2]);
  23. days++;
  24. for (int i = 0; i < hours; i++)
  25. {
  26. char currHerb = path[i];
  27. if (currHerb == 'H')
  28. {
  29. moneymade += price;
  30. }
  31. if (i == path.Length-1)
  32. {
  33. i = -1;
  34. hours = hours - path.Length;
  35. }
  36. }
  37. input = Console.ReadLine();
  38. }
  39. if(moneymade/days>=dExpenses)
  40. {
  41. Console.WriteLine("Times are good. Extra money per day: {0:F2}.",Math.Abs(moneymade/2 - dExpenses));
  42. }
  43. else
  44. {
  45. Console.WriteLine("We are in the red. Money needed: {0}.",(dExpenses*days)-moneymade);
  46. }
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement