Advertisement
roronoa

correction assessment 2

Sep 3rd, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. import java.util.*;
  2. import java.io.*;
  3. import java.math.*;
  4.  
  5. class Solution {
  6.  
  7.     public static void main(String args[]) {
  8.         Scanner in = new Scanner(System.in);
  9.         int n = in.nextInt();
  10.         if (in.hasNextLine()) {
  11.             in.nextLine();
  12.         }
  13.         String k = in.nextLine();
  14.         int[] t = new int[n];
  15.         int i = 0;
  16.         int score = 0;
  17.         int plus = 100/n;
  18.         for(int x : k.toCharArray())
  19.             t[i++] = x - 'A';
  20.         for (i = 0; i < n; i++) {
  21.             String a = in.nextLine();
  22.             if(a.replaceAll("[^X]","").length() == 1 && a.charAt(t[i]) == 'X')
  23.                 score += plus;
  24.         }
  25.  
  26.      
  27.  
  28.         System.out.println(score);
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement