We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1fc9023 commit 7f5781dCopy full SHA for 7f5781d
26A.cpp
@@ -0,0 +1,29 @@
1
+//4240326 Aug 7, 2013 5:13:59 PM fuwutu 26A - Almost Prime GNU C++0x Accepted 30 ms 0 KB
2
+#include <cstdio>
3
+
4
+int main()
5
+{
6
+ int n, amount(0);
7
+ scanf("%d", &n);
8
9
+ bool b[3001] = {false};
10
+ int pfactors[3001] = {0};
11
+ for (int i = 2; i <= n; ++i)
12
+ {
13
+ if (!b[i])
14
15
+ for (int j = i + i; j <= n; j += i)
16
17
+ b[j] = true;
18
+ pfactors[j] += 1;
19
+ }
20
21
22
+ if (pfactors[i] == 2)
23
24
+ amount += 1;
25
26
27
+ printf("%d\n", amount);
28
+ return 0;
29
+}
0 commit comments