Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _03.Logistics
- {
- class Logistics
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- double minibus = 0;
- double truck = 0;
- double train = 0;
- double sumLoad = 0;
- for (int i = 1; i <= n; i++)
- {
- double ton = double.Parse(Console.ReadLine());
- if (ton <= 3)
- {
- minibus += ton;
- }
- if (ton <= 11 && ton >= 4)
- {
- truck += ton;
- }
- if (ton >= 12)
- {
- train += ton;
- }
- sumLoad += ton;
- }
- double sumAllLoads = minibus + truck + train;
- double avgMinibus = minibus * 200;
- double avgTruck = truck * 175;
- double avgTrain = train * 120;
- double average = (avgMinibus + avgTruck + avgTrain) / sumAllLoads;
- Console.WriteLine($"{average:f2}");
- Console.WriteLine($"{(minibus / sumAllLoads * 100):f2}" + "%");
- Console.WriteLine($"{(truck / sumAllLoads * 100):f2}" + "%");
- Console.WriteLine($"{(train / sumAllLoads * 100):f2}" + "%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement