mirror of
https://github.com/tiennm99/codeforces.git
synced 2026-06-09 16:13:53 +00:00
[Init] Solved solutions
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
cin >> n;
|
||||
bool *b = new bool[n];
|
||||
b[0] = b[1] = 0;
|
||||
for (int i = 2; i < n; i++)
|
||||
{
|
||||
b[i] = 1;
|
||||
}
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (b[i] == 1)
|
||||
{
|
||||
for (int j = 2*i; j < n; j += i)
|
||||
{
|
||||
b[j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 2; i < n; i++)
|
||||
{
|
||||
if (b[i] == 0 && b[n - i] == 0)
|
||||
{
|
||||
cout << i << " " << n - i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
delete[] b;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user