From e0340c2f42a0d43624bf9351b06b541c5c195670 Mon Sep 17 00:00:00 2001 From: flowjiyun Date: Wed, 1 Feb 2023 10:20:42 +0900 Subject: [PATCH] =?UTF-8?q?feat:=201978=20=EC=86=8C=EC=88=98=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jiyunpar/math/1978.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 jiyunpar/math/1978.cpp diff --git a/jiyunpar/math/1978.cpp b/jiyunpar/math/1978.cpp new file mode 100644 index 0000000..c4eadac --- /dev/null +++ b/jiyunpar/math/1978.cpp @@ -0,0 +1,38 @@ +#include +#include +#include + +using namespace std; +int n, ans, flag; +int main(void) +{ + ios::sync_with_stdio(0); + cin.tie(0); + + ans = 0; + vector input; + input.reserve(100); + cin >> n; + for (int i = 0; i < n; ++i) + cin >> input[i]; + for (int i = 0; i < n; ++i) + { + if (input[i] == 1) + continue; + for (int j = 2; j < input[i]; ++j) + { + if (input[i] % j == 0) + { + flag = 1; + break; + } + } + if (flag == 0) + ++ans; + if (flag == 1) + flag = 0; + } + + cout << ans; + return (0); +} \ No newline at end of file