I fratelli dell'ordine di San Golfus il Conciso hanno la tradizione di recitare una breve preghiera ogni volta che vedono qualcuno che fa il segno della croce . A causa dell'elevato livello di peccato misurato recentemente tra i turisti, hanno installato telecamere a circuito chiuso nel monastero e ti hanno assunto per aiutarli a mantenere viva la vecchia tradizione nell'era dell'IA.
Il tuo compito è analizzare l'output del software di monitoraggio delle dita dei frati e dire quante preghiere sono dovute. L'input è una matrice contenente numeri interi compresi tra 0 e 4. 1,2,3,4 rappresentano le posizioni delle dita in momenti consecutivi nel tempo. 0 rappresenta non dita.
L'unico vero modo TM per incrociarsi è:
.1.
3.4
.2.
("." corrisponde a qualsiasi cifra). Tuttavia, a causa dell'incertezza sulla rotazione della telecamera e sulla presenza di pii fratelli ortodossi orientali nella folla (il cui One True Way TM è nella direzione opposta lateralmente), dovresti contare anche tutte le rotazioni e le riflessioni:
.4. .2. .3. .1. .3. .2. .4.
1.2 4.3 2.1 4.3 1.2 3.4 2.1
.3. .1. .4. .2. .4. .1. .3.
Una cifra può far parte di più croci. Aiuta i frati a determinare il numero di volte in cui la loro IA dovrebbe .pray()
contare contando quante delle precedenti matrici 3x3 presenti. Scrivi un programma o una funzione. Prendi input in qualsiasi forma conveniente conveniente.
Testamenti:
// in
[[0,4,2,0],
[1,3,2,4],
[2,3,1,0]]
// out
2
// in
[[4,3,3,2,4,4,1,3,2,2],
[0,3,0,2,1,1,2,3,2,3],
[0,3,1,3,2,4,3,3,1,1],
[4,3,2,3,2,4,1,4,2,3],
[0,4,2,3,4,0,2,3,2,4],
[2,1,0,0,2,0,0,1,2,4],
[4,0,3,1,3,2,0,3,2,3],
[1,4,3,3,1,4,0,1,4,4],
[0,2,4,3,4,3,1,3,0,4],
[3,0,1,0,4,0,3,3,3,3]]
// out
3
// in
[[3,2,3,1,0,3,4,2,1,1,1,1,4,0,1,3,1,1,2,1,1,3,0,1,0,1,1,0,0,1,0,3,4,0,1,1,2,3,1,2,4,1,0,2,3,0,2,4,3,2],
[2,4,1,1,0,3,0,2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,1,1,2,0,3,2,1,4,0,1,4,4,1,3,4,4,1,0,4,1,0,3,4,0,3,2,4,3,3,3,3,1,2,2,3,3,3,1,3,4],
[3,4,1,2,1,1,1,0,4,0,1,1,0,4,1,3,1,1,2,0,2,1,4,1,4,4,3,2,0,3,0,3,0,1,1,2,1,3,0,4,4,2,2,2,1,3,4,1,1,1],
[3,0,1,4,2,0,0,3,1,1,1,4,4,0,2,2,0,4,0,3,1,0,2,2,4,4,4,0,4,4,4,4,4,4,3,0,4,4,4,1,2,4,4,3,0,0,4,0,4,2],
[2,0,1,2,1,1,3,0,3,1,0,4,3,1,2,1,1,3,0,1,2,4,2,1,2,3,4,2,4,4,2,2,3,4,0,0,1,0,0,4,1,3,3,4,1,2,1,3,3,2],
[4,0,2,0,3,1,2,1,1,1,1,2,3,0,3,1,0,4,3,0,0,0,2,0,1,4,0,2,1,3,4,2,2,4,2,3,1,2,0,2,0,2,4,0,1,2,3,4,1,3],
[3,0,2,4,2,0,3,4,3,2,3,4,2,0,4,1,0,4,3,3,1,0,2,2,2,1,3,3,1,1,0,3,3,0,3,2,1,1,0,1,2,2,0,4,4,2,0,1,3,1],
[0,4,4,4,0,3,0,3,0,2,2,0,1,2,3,3,4,3,0,4,1,2,3,3,0,2,2,3,0,0,0,2,4,2,3,4,2,3,4,0,2,0,1,1,3,4,2,2,4,4],
[2,1,2,3,4,3,1,2,0,0,0,0,0,0,3,4,3,3,1,2,2,1,3,4,1,2,4,0,1,4,1,0,0,0,2,1,1,1,3,0,0,3,1,1,4,2,1,3,4,1],
[1,0,3,0,2,1,4,2,3,3,1,1,3,4,4,0,1,2,1,3,0,3,1,1,3,0,2,4,4,4,2,3,1,4,3,4,0,1,4,1,1,1,4,0,0,2,3,4,0,4]]
// out
8
"Sia benedetto il più breve dei più corti, perché vince il regno dei voti." -Libro di St Golfus 13:37
"Non userai scappatoie, perché sono le opere malvagie di Lucifero." -Letter a Meta 13: 666
Leggera visualizzazione delle persone che fanno la croce
Grazie @Tschallacka per la visualizzazione.