Considera una sequenza basata sulle relazioni di ricorrenza f(n) = f(n-1)+f(n-2)
, a partire da f(1) = x1, f(2) = x2
. Per x1 = 2, x2 = 1
, la sequenza inizia in questo modo:
2 1 3 4 7 11 18 29 47 76 123 199 322 521 843
Concatenarlo in una stringa darà:
213471118294776123199322521843
Ora, dividi questo elenco nei numeri più piccoli possibili che danno y(n) > y(n-1)
. Inizia con il primo numero, quindi il secondo ecc. Il primo numero di output dovrebbe essere sempre una singola cifra. Riempi l'ultimo numero con il numero richiesto di zeri.
2 13 47 111 829 4776 12319 93225 218430
Otterrai due numeri, (x1, x2)
come input, in qualsiasi formato conveniente e la sfida è quella di produrre l'elenco ordinato.
Regole:
- Funzione e programmi sono OK
- La sequenza iniziale deve avere esattamente 15 numeri (l'ultimo numero è
f(15)
). x1
ex2
sono non negativi (zero è possibile).- L'output può essere in qualsiasi formato conveniente
- Il vettore di output
y
deve essere creato in modo taley2 > y1
.- Prima il più piccolo possibile
y1
, poi il più piccolo possibiley2
, quindiy3
e così via.
- Prima il più piccolo possibile
- Se
x1 = x2 = 0
quindi emette 15 zeri (sullo stesso formato dell'altro output, ovvero no000000000000000
).
Esempi :
Input: 1 1
Output: 1 12 35 81 321 345 589 1442 3337 7610
Input: 3 2
Output: 3 25 71 219 315 0811 3121 23435 55898 145300
|
Optional leading zero
Input: 0 0
Output: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Vince il codice più breve in byte. Se possibile, includere un collegamento a un interprete online.
5467
? 54 67
? 5 46 70
?