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 Logistics
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numberOfInputs = int.Parse(Console.ReadLine());
- int busCargoInTones = 0;
- int truckCargoInTones = 0;
- int trainCargoInTones = 0;
- for (int currInput = 0; currInput < numberOfInputs; currInput++)
- {
- int cargoTones = int.Parse(Console.ReadLine());
- if (cargoTones <= 3)
- {
- busCargoInTones += cargoTones;
- }
- else if (cargoTones <= 11)
- {
- truckCargoInTones += cargoTones;
- }
- else if (cargoTones >= 12)
- {
- trainCargoInTones += cargoTones;
- }
- }
- int totalTones = busCargoInTones + truckCargoInTones + trainCargoInTones;
- double averagePerTone = ((busCargoInTones * 200.0) +
- (truckCargoInTones * 175.0) +
- (trainCargoInTones * 120.0)) /
- totalTones;
- double percentOfCargoForBus = (busCargoInTones / (double)totalTones) * 100;
- double percentOfCargoForTruck = (truckCargoInTones / (double)totalTones) * 100;
- double percentOfCargoForTrain = (trainCargoInTones / (double)totalTones) * 100;
- Console.WriteLine($"{averagePerTone:f2}");
- Console.WriteLine($"{percentOfCargoForBus:f2}%");
- Console.WriteLine($"{percentOfCargoForTruck:f2}%");
- Console.WriteLine($"{percentOfCargoForTrain:f2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement