Untitled

 avatar
unknown
plain_text
2 years ago
964 B
3
Indexable
import java.util.Scanner;

public class Main
{
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int groups = Integer.parseInt(scanner.nextLine());
		double fuji = 0;
		double montBlanc = 0;
		double kilimanjaro = 0;
		double k2 = 0;
		double mountEverest = 0;
		int all = 0;
		
		for (int i = 0; i < groups; i++) {
		    int people = Integer.parseInt(scanner.nextLine());
		    all+=people;
		    if (people < 6) {
		        fuji+=people;
		    } else if (people >= 6 && people <= 12) {
		        montBlanc+=people;
		    } else if (people >= 13 && people <= 25) {
		        kilimanjaro+=people;
		    } else if (people >= 26 && people <= 40) {
		        k2+=people;
		    } else if (people >= 41) {
		        mountEverest+=people;
		    }
		}
		
	   System.out.printf("%.2f\n%.2f\n%.2f\n%.2f\n%.2f\n", ((fuji/all) *100), ((montBlanc/all) *100), ((kilimanjaro/all) *100), ((k2/all) *100), ((mountEverest/all) *100));
		
	}
}
Editor is loading...