######################### 1831 ############## ################
Use 5.010; </P> <p> chomp (my $ ord = <stdin>); </P> <p> chomp (my $ change = <stdin> ); </P> <p> say $ change; </P> <p> say $ ord; </P> <p> while (<>) {</P> <p> eval "TR/$ ord/$ change/"; </P> <p> Print; </P> <p>}
######################### 1854 ############## ################
My % hash; </P> <p> while (Chomp (my $ party = <stdin>) {</P> <p> for (1 .. $ party) {</P> <p> chomp (my $ name = <stdin>); </P> <p> chomp (my $ cand = <stdin> ); </P> <p> $ hash {$ name} = $ cand; </P> <p >}</P> <p> chomp (my $ n = <stdin>); </P> <p> my % hash_vote; </P> <p> for (1 .. $ n) {</P> <p> chomp (my $ vote = <stdin>); </P> <p> $ hash_vote {$ vote} ++; </P> <p >}</P> <p> my @ arr = sort {$ B <=> $ A} values % hash_vote; # DESC sort </P> <p> if ($ arr [0] = $ arr [1]) {</P> <p> Print "Tie/N "; </P> <p >}else {</P> <p> for (Keys % hash_vote) {</P> <p> Print $ hash {$ _}, "/N" If $ hash_vote {$ _ }=$ arr [0]; </P> <p >}</P> <p> UNDEF % hash; # Empty the hashtalbe </P> <p> UNDEF % hash_vote; # Empty too </P> <p>}
######################### 1858 ############## ################
Use 5.010; </P> <p> while (<>) {</P> <p> TR/bfpvcgjkqsxzdtlmnr/111122222222334556 /; </P> <p> S /(.) /1 */$1/g; </P> <p> S/D/g; </P> <p> say; </P> <p>}
######################### 2176 ############## ################
Use 5.010; </P> <p> while (Chomp (my $ case = <stdin>) {</P> <p> last if $ case EQ '-1 '; </P> <p> my $ time = 0; </P> <p> my $ sum = 0; </P> <p> while ($ case --) {</P> <p> chomp (my $ line = <stdin>); </P> <p> my @ arr = Split '', $ line; </P> <p> $ sum + = $ arr [0] * ($ arr [1]-$ time ); </P> <p> $ time = $ arr [1]; </P> <p >}</P> <p> say "$ sum Miles "; </P> <p >}
######################### 2201 ##############################
Use 5.010; </P> <p> chomp (my $ n = <stdin>); </P> <p> for (1 .. $ n) {</P> <p> my @ arr = Split '', <stdin>; </P> <p> $ arr [0] <$ arr [1]? Say "No brains": Say "Mmm brains"; </P> <p>}
######################### 2417 ############## ################
While (<stdin>) {</P> <p> chomp; </P> <p> last if! $ _; </P> <p> my $ n = 0; </P> <p> until ($ _ % 2 )) {</P> <p> $ n ++; </P> <p> $ _/= 2; </P> <p >}</P> <p> Print 1 <$ N, "/N"; </P> <p>}
######################### 3333 ############## ################
Use 5.010; </P> <p> chomp (my $ case = <stdin>); </P> <p> for (1 .. $ case) {</P> <p> my ($ P, $ P1, $ P2) = Split '', <stdin>; </P> <p> ABS $ p-$ P1> ABS $ p-$ P2? Say 'B': Say 'a'; </P> <p>}
Zoj (1001 | 1048 | 1109 | 1151 | 1240 | 1241 | 1608 | 1808) perl version