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 _04.Logistics
- {
- class Program
- {
- static void Main(string[] args)
- {
- int transports = int.Parse(Console.ReadLine());
- double microbus = 0.0;
- double truck = 0.0;
- double train = 0.0;
- double sumTons = 0.0;
- double tonsMicrobus = 0.0;
- double tonsTruck = 0.0;
- double tonsTrain = 0.0;
- double avarageTons = 0.0;
- for (int i = 1; i <= transports; i++)
- {
- int tons = int.Parse(Console.ReadLine());
- if (tons <= 3)
- {
- microbus = tons * 200;
- tonsMicrobus += tons;
- }
- else if (tons >= 4 && tons <= 11)
- {
- truck = tons * 175;
- tonsTruck += tons;
- }
- else
- {
- train = tons * 120;
- tonsTrain += tons;
- }
- }
- sumTons = tonsTrain + tonsMicrobus + tonsTruck;
- avarageTons = (microbus + truck + train) / sumTons;
- double microbusPerCent = (tonsMicrobus / sumTons) * 100;
- double truckPerCent = (tonsTruck / sumTons) * 100;
- double trainPerCent = (tonsTrain / sumTons) * 100;
- Console.WriteLine($"{avarageTons:f2}");
- Console.WriteLine($"{microbusPerCent:f2}%");
- Console.WriteLine($"{truckPerCent:f2}%");
- Console.WriteLine($"{trainPerCent:f2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement