Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _03.Logistics
- {
- using System;
- class StartUp
- {
- static void Main(string[] args)
- {
- double doubleConverter = 1.0;
- int n = int.Parse(Console.ReadLine());
- double priceMiniBus = 0;
- double priceTruck = 0;
- double priceTrain = 0;
- int allTones = 0;
- int tonesMinibus = 0;
- int tonesTruck = 0;
- int tonesTrain = 0;
- for (int i = 0; i < n; i++)
- {
- int tones = int.Parse(Console.ReadLine());
- allTones += tones;
- if (tones < 4)
- {
- tonesMinibus += tones;
- priceMiniBus += tones * 200;
- }
- else if (tones < 12)
- {
- tonesTruck += tones;
- priceTruck += tones * 175;
- }
- else
- {
- tonesTrain += tones;
- priceTrain += tones * 120;
- }
- }
- double middlePrice = (priceMiniBus + priceTruck + priceTrain) / allTones;
- double pTonesMinibus = doubleConverter * tonesMinibus / allTones * 100;
- double pTonesTruck = doubleConverter * tonesTruck / allTones * 100;
- double pTonesTrain = doubleConverter * tonesTrain / allTones * 100;
- Console.WriteLine($"{middlePrice:f2}");
- Console.WriteLine($"{pTonesMinibus:f2}%");
- Console.WriteLine($"{pTonesTruck:f2}%");
- Console.WriteLine($"{pTonesTrain:f2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement