Página Principal

MC521-1s2014

MC621-2s2014

MC521-1s2015

MC621-2s2015

MC521-1s2016

Conteúdo

Área Reservada

edit sidebar

Design Tutorial: Learn from Math

Enunciado

/*** Autor: Mateus Bellomo ***/
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#define MAX 1000100
typedef long long ll;
using namespace std;
int n;
int sieve[1000100];

int main(){
  scanf(" %d", &n);

  for(ll i = 2; i <= 1000; i++){
    if(sieve[i]) continue;
    ll j = 2;
    while(i*j < MAX)
      sieve[i*j] = 1, j++;
  }

  for(int i = 0; i < n; i++)
    if(sieve[i] && sieve[n-i]){
      printf("%d %d\n", i, n-i);
      break;
    }


  return 0;
}