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 Logistic
- {
- class Logistic
- {
- static void Main(string[] args)
- {
- decimal goodsAmount = decimal.Parse(Console.ReadLine());
- decimal bus = 0;
- decimal truck = 0;
- decimal train = 0;
- for (decimal i = 0; i < goodsAmount; i++)
- {
- decimal weight = decimal.Parse(Console.ReadLine());
- if (weight >= 11)
- {
- train += weight;
- }
- else if (weight > 3)
- {
- truck += weight;
- }
- else
- {
- bus += weight;
- }
- }
- decimal sumWeight = (truck + train + bus);
- decimal busPercent = bus / sumWeight * 100;
- decimal truckPercent = truck / sumWeight * 100;
- decimal trainPercent = train / sumWeight * 100;
- decimal averragePrice = (bus * 200 + truck * 175 + train * 120) / sumWeight;
- Console.WriteLine($"{averragePrice:f2}");
- Console.WriteLine($"{busPercent:f2}%");
- Console.WriteLine($"{truckPercent:f2}%");
- Console.WriteLine($"{trainPercent:f2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement