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 test1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int allseats = int.Parse(Console.ReadLine());
- int allfans = int.Parse(Console.ReadLine());
- int fansA = 0;
- int fansB = 0;
- int fansV = 0;
- int fansG = 0;
- double percA;
- double percB = 0.0;
- double percV = 0.0;
- double percG = 0.0;
- double percall = 0.0;
- for (int i = 1; i <= allfans; i++)
- {
- string sector = Console.ReadLine();
- switch (sector)
- {
- case "A": fansA = fansA + 1;break;
- case "B": fansB = fansB + 1;break;
- case "V": fansV = fansV + 1;break;
- case "G": fansG = fansG + 1;break;
- }
- }
- percA = (fansA / allfans) * 100;
- percB = (fansB / allfans) * 100;
- percV = (fansV / allfans) * 100;
- percG = (fansG / allfans) * 100;
- percall = (allfans / allseats) * 100;
- Console.WriteLine("{0:f2}", percA);
- Console.WriteLine("{0:f2}", percB);
- Console.WriteLine("{0:f2}", percV);
- Console.WriteLine("{0:f2}", percG);
- Console.WriteLine("{0:f2}", percall);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement