[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [obm-l] Tres Probleminhas



Claudio Buffara wrote:
> 
> 1. Expressar o numero 19 usando uma unica vez cada um dos numeros 1, 2 e 3 e
> mais as operacoes matematicas usuais (+, -, *, /, raizes, fatoriais, etc.).
> Nao vale usar ponto decimal nem a funcao maior inteiro. (essa eh pro Qwert!)

	Isso me lembra a vez que tentei resolver de maneira
genérica não apenas o problema dos quatro quatros, mas também
dos cinco cincos e todos os correlatos. Fiz um programinha que
associava um custo a cada função, e então fiz a busca exaustiva.
Para os custos dados, a tabela abaixo tem o jeito mais simples
de resolver cada número:

#define P_PLUS 1
#define P_MINUS 3
#define P_TIMES 10
#define P_DIV 30
#define P_FATORIAL 100
#define P_POT 250
#define P_SQRT 500
#define P_BINOMIAL 750
#define P_FALLING 3000
#define P_RISING 3000
#define P_FLOOR 10000

----------------------------------------------------------------
Ricardo Bittencourt                   http://www.mundobizarro.tk
ricbit@700km.com.br  "kimitatino kitiwa subete CATS ga itadaita"
------ União contra o forward - crie suas proprias piadas ------

   0 = (44-44)
   1 = (44/44)
   2 = (4-((4+4)/4))
   3 = ((4+(4+4))/4)
   4 = (4+(4*(4-4)))
   5 = ((4+(4*4))/4)
   6 = (4+((4+4)/4))
   7 = ((44/4)-4)
   8 = ((4+4)+(4-4))
   9 = ((4+4)+(4/4))
  10 = ((44-4)/4)
  11 = (4+((4+4!)/4))
  12 = ((4+44)/4)
  13 = (4!-(44/4))
  14 = (4+(4+(4!/4)))
  15 = (4+(44/4))
  16 = ((4+4)+(4+4))
  17 = ((4*4)+(4/4))
  18 = (4!-((4-(4/4)))!)
  19 = (4!-(4+(4/4)))
  20 = (4*(4+(4/4)))
  21 = ((4/4)+(4!-4))
  22 = (4!-((4+4)/4))
  23 = (((4*4!)-4)/4)
  24 = ((4+4)+(4*4))
  25 = ((4+(4*4!))/4)
  26 = (4!+((4+4)/4))
  27 = (4+(4!-(4/4)))
  28 = (44-(4*4))
  29 = (4+(4!+(4/4)))
  30 = (((4+(4/4)))!/4)
  31 = (4!+((4+4!)/4))
  32 = ((4*4)+(4*4))
  33 = (binomial((4!/sqrt(4)),sqrt(4))/sqrt(4))
  34 = (4!+(4+(4!/4)))
  35 = (4!+(44/4))
  36 = (44-(4+4))
  37 = (4!+((4!+sqrt(4))/sqrt(4)))
  38 = (44-(4!/4))
  39 = (4!+binomial((4!/4),4))
  40 = ((4*(4*4))-4!)
  41 = floor((44-sqrt((4+4))))
  42 = (4!+(4!-(4!/4)))
  43 = (44-(4/4))
  44 = ((4-4)+44)
  45 = ((4/4)+44)
  46 = (4+(44-sqrt(4)))
  47 = (4!+(4!-(4/4)))
  48 = (4*(4+(4+4)))
  49 = (4!+(4!+(4/4)))
  50 = (44+(4!/4))
  51 = ceil((44+sqrt(44)))
  52 = ((4+4)+44)
  53 = floor(((4+4)*sqrt(44)))
  54 = ((4!/4)+(4!+4!))
  55 = binomial((44/4),sqrt(4))
  56 = (4!+(4*(4+4)))
  57 = ceil((sqrt((4+4))*(4!-4)))
  58 = (((4^4)-4!)/4)
  59 = (4!+(rising(4,4)/4!))
  60 = ((4*4)+44)
  61 = ((sqrt(4)+rising(sqrt(4),4))/sqrt(4))
  62 = ((4*(4*4))-sqrt(4))
  63 = (((4^4)-4)/4)
  64 = ((4+4)*(4+4))
  65 = ((4+(4^4))/4)
  66 = (sqrt(4)+(4*(4*4)))
  67 = ((4*4!)-ceil((4!+sqrt(4!))))
  68 = (4+(4*(4*4)))
  69 = ceil((sqrt(4!)+(4*(4*4))))
  70 = ((4!+(4^4))/4)
  71 = ceil((((4*4!)-4!)-sqrt(sqrt(4))))
  72 = (4+(4!+44))
  73 = ceil((sqrt(4!)+(4!+44)))
  74 = (((4*4!)-4!)+sqrt(4))
  75 = ((4*(4!-4))-ceil(sqrt(4!)))
  76 = ((4*(4!-4))-4)
  77 = ceil((((4*4!)-4!)+sqrt(4!)))
  78 = ((4*(4!-4))-sqrt(4))
  79 = floor((sqrt((4+4))*(4+4!)))
  80 = (4*(4+(4*4)))
  81 = ((4-(4/4))^4)
  82 = (sqrt(4)+(4*(4!-4)))
  83 = floor(((sqrt(4)*44)-sqrt(4!)))
  84 = (4+(4*(4!-4)))
  85 = (ceil(sqrt(4!))+(4*(4!-4)))
  86 = ((sqrt(4)*44)-sqrt(4))
  87 = (((4*4!)-4)-ceil(sqrt(4!)))
  88 = (44+44)
  89 = floor(((4*4!)-sqrt(44)))
  90 = ((4*4!)-(4!/4))
  91 = binomial(((4*4)-sqrt(4)),sqrt(4))
  92 = (4*(4!-(4/4)))
  93 = floor(((4*4!)-sqrt((4+4))))
  94 = (sqrt(4)+((4*4!)-4))
  95 = ((4*4!)-(4/4))
  96 = (4*(4!+(4-4)))
  97 = ((4/4)+(4*4!))
  98 = ((4*4!)+(4-sqrt(4)))
  99 = ceil((sqrt((4+4))+(4*4!)))
100 = (4*(4!+(4/4)))
=========================================================================
Instruções para entrar na lista, sair da lista e usar a lista em
http://www.mat.puc-rio.br/~nicolau/olimp/obm-l.html
=========================================================================