Advertisement
Guest User

Untitled

a guest
Nov 27th, 2016
1,062
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 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 _04.Logistics
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int countOfLoads = int.Parse(Console.ReadLine());
  14.  
  15. int sumTons = 0;
  16.  
  17. double microbus = 0;
  18. double truck = 0;
  19. double train = 0;
  20.  
  21. for (int i = 1; i <= countOfLoads; i++)
  22. {
  23. int tons = int.Parse(Console.ReadLine());
  24.  
  25. if (tons <= 3)
  26. {
  27. microbus += tons;
  28. }
  29. else if (tons >= 4 && tons <= 11)
  30. {
  31. truck += tons;
  32. }
  33. else if (tons >= 12)
  34. {
  35. train += tons;
  36. }
  37.  
  38. sumTons += tons;
  39. }
  40.  
  41. double microbusPrice = microbus * 200.0;
  42. double truckPrice = truck * 175.0;
  43. double trainPrice = train * 120.0;
  44.  
  45. double totalPrice = microbusPrice + truckPrice + trainPrice;
  46.  
  47. Console.WriteLine("{0:f2}" , totalPrice / sumTons);
  48. Console.WriteLine("{0:f2}%", (microbus / sumTons) * 100);
  49. Console.WriteLine("{0:f2}%", (truck / sumTons) * 100);
  50. Console.WriteLine("{0:f2}%", (train / sumTons) * 100);
  51. }
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement