VioletaBabel
1978번: 소수 찾기 본문
#include <iostream>
using namespace std;
int main()
{
int n, count = 0, num;
cin >> n;
for (int i = 0; i < n; ++i)
{
cin >> num;
if (num > 1)
{
for (int j = 2; j*j <= num; ++j)
if (num%j == 0)
{
--count;
break;
}
++count;
}
}
cout << count;
}
'백준 > 백준-C++' 카테고리의 다른 글
| 5054번: 주차의 신 (0) | 2017.05.26 |
|---|---|
| 1929번: 소수 구하기 (0) | 2017.05.26 |
| 10866번: 덱 (0) | 2017.05.26 |
| 11004번: K번째 수 (0) | 2017.05.26 |
| 10828번: 스택 (0) | 2017.05.26 |
Comments