Skip to content

Instantly share code, notes, and snippets.

@yeopgi
Created August 28, 2021 05:19
Show Gist options
  • Save yeopgi/a78e9fb7c166c0fd225fcb0c95989b56 to your computer and use it in GitHub Desktop.
Save yeopgi/a78e9fb7c166c0fd225fcb0c95989b56 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int testCnt;
cin >> testCnt;
int primeCnt = testCnt;
int test[100] = {0};
for (int i = 0; i < testCnt; i++) {
cin >> test[i];
if(test[i] <= 1) {
primeCnt--;
continue;
}
for (int j = 2; j * j<= test[i]; j++) {
if(test[i] % j == 0) {
primeCnt--;
break;
}
}
}
cout << primeCnt;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment