Created
August 28, 2021 05:19
-
-
Save yeopgi/a78e9fb7c166c0fd225fcb0c95989b56 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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