Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package exam18december;
- import java.util.Scanner;
- /**
- * Created by admin090517 on 9.7.2017 г..
- */
- public class football {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int capacity = Integer.parseInt(scanner.nextLine());
- int n = Integer.parseInt(scanner.nextLine());
- int a = 0;
- int b = 0;
- int v = 0;
- int g = 0;
- for (int i = 0; i < n; i++) {
- String sector = scanner.nextLine();
- if("A".equals(sector)) {
- a++;
- } else if ("B".equals(sector)) {
- b++;
- } else if("V".equals(sector)) {
- v++;
- } else if ("G".equals(sector)) {
- g++;
- }
- }
- System.out.printf("%.2f%%%n",a*1.0/n*100);
- System.out.printf("%.2f%%%n",b*1.0/n*100);
- System.out.printf("%.2f%%%n",v*1.0/n*100);
- System.out.printf("%.2f%%%n",g*1.0/n*100);
- System.out.printf("%.2f%%%n",n*1.0/capacity*100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement