[CONTEST] Trovare il numero del post a partire dalla targa

« Older   Newer »
  Share  
/dev/random
CAT_IMG Posted on 22/2/2011, 15:43     +1   -1




Nessuno? Non ci credo...
 
Top
I.Ren
CAT_IMG Posted on 22/2/2011, 17:14     +1   -1




Io devo ancora capire cosa sono ste targhe O:
 
Top
/dev/random
CAT_IMG Posted on 22/2/2011, 17:21     +1   -1




Guarda in OT
 
Top
3ad
CAT_IMG Posted on 22/2/2011, 22:44     +1   -1




Si! Ci sono riuscito!
Eccolo qui :D :P

Source:
SPOILER (click to view)
CODICE
$String="AA 001 BA"
ConsoleWrite(_GetNumberPost($String))

Func _GetNumberPost($T)
$Sp=StringSplit($T," ")
$N=$Sp[2]
$P=Asc(StringLeft($Sp[1],1))-65
$S=Asc(StringRight($Sp[1],1))-65
$P2=Asc(StringLeft($Sp[3],1))-65
$S2=Asc(StringRight($Sp[3],1))-65
       
$S22=$S2*999
$P22=$P2*999*26
$S11=$S*999*26*26
$P11=$P*999*26*26*26
Return $N+$S22+$P22+$S11+$P11
EndFunc;==>_GetNumberPost


Modificato come richiesto da dev:
SPOILER (click to view)
CODICE
$String="AA 001 BA"
ConsoleWrite(_GetNumberPost($String))

Func _GetNumberPost($T)
$Sp=StringSplit($T," ")
$N=$Sp[2]
$P=Asc(StringLeft($Sp[1],1))-65
$S=Asc(StringRight($Sp[1],1))-65
$P2=Asc(StringLeft($Sp[3],1))-65
$S2=Asc(StringRight($Sp[3],1))-65

Return $S2*999+$P2*25974+$S*675324+$P*17558424+$N
EndFunc;==>_GetNumberPost


Modificato per la 2° volta <.<
SPOILER (click to view)
CODICE
$String="AA 001 BA"
ConsoleWrite(_GetNumberPost($String))

Func _GetNumberPost($T)
$Sp=StringSplit($T," ")
$N=$Sp[2]
$P=Asc(StringLeft($Sp[1],1))-65
$S=Asc(StringRight($Sp[1],1))-65
$P2=Asc(StringLeft($Sp[3],1))-65
$S2=Asc(StringRight($Sp[3],1))-65
       
Return $S2*999+$P2*999*26+$S*999*(26^2)+$P*999*(26^3)+$N
EndFunc;==>_GetNumberPost


Edited by 3ad - 23/2/2011, 17:12
 
Top
/dev/random
CAT_IMG Posted on 23/2/2011, 15:15     +1   -1




Ok, funziona, ma dovresti "usare un'unica espressione dopo aver trovato i dati".

Inoltre i 26^x possono essere scritti in un altro modo che facilita la comprensione dell'algoritmo.

Comunque bravo, hai ownato Master :D
 
Top
3ad
CAT_IMG Posted on 23/2/2011, 16:45     +1   -1




:D Ora sistemo ;)
EDIT: Sistemato e aggiunto il codice insieme all' altro.
 
Top
/dev/random
CAT_IMG Posted on 23/2/2011, 17:02     +1   -1




Ora è ok con il regolamento però non era quello che intendevo per i 26^x
 
Top
3ad
CAT_IMG Posted on 23/2/2011, 17:09     +1   -1




<.< ECHEPALLE vabbè faccio come dici tu xD
EDIT: Va bene così?
SPOILER (click to view)
Entra su IRC...

 
Top
/dev/random
CAT_IMG Posted on 23/2/2011, 17:31     +1   -1




asd andava bene lo stesso comunque io avrei (ho) messo anche 26^0 e 26^1.

guardachesescriviilcodicetuttoappiccicatonessunocicapiràniente:|
 
Top
Aaly
CAT_IMG Posted on 23/2/2011, 17:44     +1   -1




/dev certo che non ti va mai bene niente, lol.
 
Top
/dev/random
CAT_IMG Posted on 23/2/2011, 17:48     +1   -1




Se vuole scrivere codice sporco è libero di farlo. Dovreste sapere, come ho già detto molte volte, che quello che mi passa per la testa lo dico senza farmi troppi problemi.
 
Top
3ad
CAT_IMG Posted on 23/2/2011, 17:55     +1   -1




asd E fai bene ;)
 
Top
/dev/random
CAT_IMG Posted on 23/2/2011, 17:57     +1   -1




:D
 
Top
/dev/random
CAT_IMG Posted on 23/2/2011, 21:12     +1   -1




FINE DEL CONTEST!
 
Top
28 replies since 19/2/2011, 23:25   485 views
  Share