Compito: il titolo lo riassume praticamente: aumentare un numero intero x per alimentare x , dove 0<x
.
restrizioni:
- Uso di elevamento a potenza,
exp()
,ln()
, linguistiche e qualsiasi altro potere-correlati built-in, comepow()
,x^x
,x**x
è vietato. - Puoi presumere che il dato numero intero corrisponda ai limiti del linguaggio di programmazione che preferisci.
Casi test:
Input | Output
---------------
2 | 4
3 | 27
5 | 3125
6 | 46656
10 | 10000000000
Questo è code-golf , quindi vince il programma più breve in byte.
0
e che specificare i risultati attesi ( 0
o 1
o uno). Infine, dover gestire numeri interi negativi sarebbe una bella aggiunta alla sfida.
1
per 0^0
. Tuttavia, Foundation
+ Swift restituisce 0
0
e invece l' ho specificata 0<x
nel lead-in. Ho anche rimosso la restrizione che il codice non dovrebbe generare errori; questo dovrebbe essere ovvio. Sentiti libero di tornare indietro se necessario.