| 3 | import java.util.Scanner; |
| 4 | |
| 5 | public class Problem9 { |
| 6 | |
| 7 | static int is_prime(int n) { |
| 8 | int i, root; |
| 9 | |
| 10 | if (n < 2) { |
| 11 | return 0; |
| 12 | } |
| 13 | |
| 14 | if (n == 2) { |
| 15 | return 1; |
| 16 | } |
| 17 | |
| 18 | if (n % 2 == 0) { |
| 19 | return 0; |
| 20 | } |
| 21 | |
| 22 | root = (int) Math.sqrt(n); |
| 23 | |
| 24 | for (i = 3; i <= root; i += 2) { |
| 25 | if (n % i == 0) { |
| 26 | return 0; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | return 1; |
| 31 | } |
| 32 | |
| 33 | public static void main(String[] args) { |
| 34 | // TODO Auto-generated method stub |
| 35 | Scanner scan = new Scanner(System.in); |
| 36 | int[] primeCount; |
| 37 | int N; |
| 38 | String line; |
| 39 | String[] numbersInALineStr; |
| 40 | int[] numbersInALineStrInt; |
| 41 | |
| 42 | N = scan.nextInt(); |
| 43 | scan.nextLine(); |
| 44 | primeCount = new int[N]; |
| 45 | |
| 46 | for (int i = 0; i < N; i++) { |
| 47 | line = scan.nextLine(); |
| 48 | int individualPrimeCount = 0; |
| 49 | |
| 50 | numbersInALineStr = line.trim().split("\\s+"); |
| 51 | numbersInALineStrInt = new int[numbersInALineStr.length]; |
| 52 | |
| 53 | for (int j = 0; j < numbersInALineStr.length; j++) { |
| 54 | numbersInALineStrInt[j] = Integer.parseInt(numbersInALineStr[j]); |
| 55 | } |
| 56 | |
| 57 | for (int number : numbersInALineStrInt) { |
| 58 | while (number < 0 || number > 100) { |
| 59 | line = scan.nextLine(); |
| 60 | |
| 61 | numbersInALineStr = line.trim().split("\\s+"); |
| 62 | numbersInALineStrInt = new int[numbersInALineStr.length]; |
nothing calls this directly
no outgoing calls
no test coverage detected