๐ ๋ฐฑ์ค 1978 ์์ ์ฐพ๊ธฐ https://www.acmicpc.net/problem/1978
๋ฌธ์ 
์ฃผ์ด์ง ์ N๊ฐ ์ค์์ ์์๊ฐ ๋ช ๊ฐ์ธ์ง ์ฐพ์์ ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค.
์ ๋ ฅ
์ฒซ ์ค์ ์์ ๊ฐ์ N์ด ์ฃผ์ด์ง๋ค. N์ 100์ดํ์ด๋ค. ๋ค์์ผ๋ก N๊ฐ์ ์๊ฐ ์ฃผ์ด์ง๋๋ฐ ์๋ 1,000 ์ดํ์ ์์ฐ์์ด๋ค.
์ถ๋ ฅ
์ฃผ์ด์ง ์๋ค ์ค ์์์ ๊ฐ์๋ฅผ ์ถ๋ ฅํ๋ค.
ํ์ด
์ด์ ์ ํฌ์คํ ํ๋ ์์ ๊ตฌํ๊ธฐ ๋ฌธ์ ๋ฅผ ํ์๋ค๋ฉด ์ด ๋ฌธ์ ๋ํ ์ฝ๊ฒ ํ ์ ์๋ค.
์์ ๊ตฌํ๊ธฐ : https://hyoreal.github.io/posts/BaekJoon-1929-%EC%86%8C%EC%88%98-%EA%B5%AC%ED%95%98%EA%B8%B0-JAVA/
์ด ์  ์์๋ฅผ ๊ตฌํ๋ ์ฝ๋๋ฅผ ํ์ฉํ์ฌ ์์๋ผ๋ฉด true, ์๋๋ผ๋ฉด false๋ฅผ ๋ฆฌํดํ๋๋ก ํ์ฌ ์กฐ๊ฑด๋ฌธ์์ count๋ฅผ ์ธ์ด์ฃผ์๋ค.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.io.*;
import java.util.StringTokenizer;
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        br.readLine();
        int count = 0;
        StringTokenizer st = new StringTokenizer(br.readLine());
        while (st.hasMoreTokens()) {
            if (isPrime(Integer.parseInt(st.nextToken()))) count++;
        }
        System.out.println(count);
    }
    private static boolean isPrime(int num) {
        if (num == 1) return false;
        for (int i = 2; i <= Math.sqrt(num); i++) {
            if (num % i == 0) return false;
        }
        return true;
    }
}