Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TrekkingMania {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int groupNumbers = Integer.parseInt(scanner.nextLine());
- int musala = 0, montBlanc = 0, kilimanjaro = 0, k2 = 0, everest = 0, alpinistSum = 0;
- for (int i = 0; i < groupNumbers; i++) {
- int group = Integer.parseInt(scanner.nextLine());
- alpinistSum += group;
- if (group > 40) {
- everest += group;
- } else if (group > 25) {
- k2 += group;
- } else if (group > 12) {
- kilimanjaro += group;
- } else if (group > 5) {
- montBlanc += group;
- } else if (group > 0) {
- musala += group;
- }
- }
- System.out.printf("%.2f%%\n", 100.0 * musala / alpinistSum);
- System.out.printf("%.2f%%\n", 100.0 * montBlanc / alpinistSum);
- System.out.printf("%.2f%%\n", 100.0 * kilimanjaro / alpinistSum);
- System.out.printf("%.2f%%\n", 100.0 * k2 / alpinistSum);
- System.out.printf("%.2f%%\n", 100.0 * everest / alpinistSum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement