Advertisement
paykova

EnduranceRally

Feb 25th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 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 _3P.EnduranceRally
  8. {
  9. public class EnduranceRally
  10. {
  11. public static void Main()
  12. {
  13. string[] names = Console.ReadLine().Split();
  14.  
  15. double[] zones = Console.ReadLine()
  16. .Split()
  17. .Select(double.Parse)
  18. .ToArray();
  19.  
  20. double[] checkPoints = Console.ReadLine().
  21. Split()
  22. .Select(double.Parse)
  23. .ToArray();
  24.  
  25. double sum = 0;
  26. foreach (var person in names)
  27. {
  28. foreach (var c in person)
  29. {
  30. var firsteLetter = (int)c;
  31. sum = firsteLetter;
  32. break;
  33. }
  34.  
  35. for (int i = 0; i < checkPoints.Length; i++)
  36. {
  37. for (int j = 0; j < zones.Length; j++)
  38. {
  39. if (i == checkPoints[j])
  40. {
  41. sum =sum + (zones[j]);
  42. break;
  43. }
  44. else
  45. {
  46. sum =sum - (zones[j]);
  47. }
  48. break;
  49. }
  50. Console.WriteLine(sum);
  51.  
  52. }
  53.  
  54. }
  55. }
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement