Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int stadiumCapacity = Integer.parseInt(scanner.nextLine()),
- fanCount = Integer.parseInt(scanner.nextLine()),
- sectorA = 0, sectorB = 0, sectorV = 0, sectorG = 0;
- String currentFanSector;
- for (int i = 0; i < fanCount; i++) {
- currentFanSector = scanner.nextLine();
- switch (currentFanSector) {
- case "A" -> sectorA++;
- case "B" -> sectorB++;
- case "V" -> sectorV++;
- default -> sectorG++;
- }
- }
- System.out.printf("%.2f%%\n", 100.0 * sectorA / fanCount);
- System.out.printf("%.2f%%\n", 100.0 * sectorB / fanCount);
- System.out.printf("%.2f%%\n", 100.0 * sectorV / fanCount);
- System.out.printf("%.2f%%\n", 100.0 * sectorG / fanCount);
- System.out.printf("%.2f%%\n", 100.0 * fanCount / stadiumCapacity);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement