Programing/백준, 프로그래머스(C++)
[C++][백준 1978] 소수 찾기
hye3193
2025. 1. 3. 15:20
https://www.acmicpc.net/problem/1978
제출 코드
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, count = 0;
cin >> n;
for (int i = 0; i < n; i++)
{
int a;
cin >> a;
if (a != 1) count++;
for (int j = 2; j < a; j++)
{
if (a % j == 0)
{
count--;
break;
}
}
}
cout << count;
}