[SP-pm] Facebook World Cup 2012 Fase 1

Daniel Mantovani daniel.oliveira.mantovani at gmail.com
Mon Jan 30 04:46:55 PST 2012


Tiago Peczenyj, Apos contar o numero de letras "H-A-C-K-E-R-C-U-P" na linha voce vai ter algo como,

H -> 54,
A -> 100,
C -> 30 / 2 (15), #pois o C repete
K -> ...

Apos voce ter um hash com os valores, voce deve pegar o de valor mais baixo pois com o valor mais baixo 'e o numero de vezes que voce consegue escrever a palavra.

-- 
Software Engineer
Just Another Perl Hacker
Daniel Mantovani +5511 8538-9897
XOXO

On Jan 30, 2012, at 12:00 AM, Tiago Peczenyj wrote:

> sim, mas o que causa a diferença? não entendi pq vc usa um sort...
> acho q eu não entendi o problema :/
> 
> 2012/1/29 Daniel Mantovani <daniel.oliveira.mantovani em gmail.com>:
>>  Tiago Peczenyj, eu coloquei um diff dos resultados no seu facebook.
>> 
>> --
>> Software Engineer
>> Just Another Perl Hacker
>> Daniel Mantovani +5511 8538-9897
>> XOXO
>> 
>> On Jan 29, 2012, at 11:31 PM, Tiago Peczenyj wrote:
>> 
>> Mantovani
>> 
>> Eu to com preguiça mas... qual foi o meu erro?
>> 
>> dá um help ae
>> 
>> 2012/1/29 Daniel Mantovani <daniel.oliveira.mantovani em gmail.com>:
>> 
>> Agora que a fase um ja terminou, podemos brincar com os problemas.
>> 
>> 
>> O Wesley Seidel, me chamou hoje no Google Talk e comentou sobre os
>> 
>> problemas. Ele me mandou os problemas e me pareceram bem legais, eu parei
>> 
>> para mexer em apenas um deles hoje:
>> 
>> 
>> Alphabet Soup
>> 
>> 
>> 
>> Alfredo Spaghetti really likes soup, especially when it contains alphabet
>> 
>> pasta. Every day he constructs a sentence from letters, places the letters
>> 
>> into a bowl of broth and enjoys delicious alphabet soup.
>> 
>> 
>> Today, after constructing the sentence, Alfredo remembered that the Facebook
>> 
>> Hacker Cup starts today! Thus, he decided to construct the phrase
>> 
>> "HACKERCUP". As he already added the letters to the broth, he is stuck with
>> 
>> the letters he originally selected. Help Alfredo determine how many times he
>> 
>> can place the word "HACKERCUP" side-by-side using the letters in his soup.
>> 
>> 
>> Input
>> 
>> 
>> The first line of the input file contains a single integer T: the number of
>> 
>> test cases. T lines follow, each representing a single test case with a
>> 
>> sequence of upper-case letters and spaces: the original sentence Alfredo
>> 
>> constructed.
>> 
>> 
>> Output
>> 
>> 
>> Output T lines, one for each test case. For each case, output "Case #t: n",
>> 
>> where t is the test case number (starting from 1) and n is the number of
>> 
>> times the word "HACKERCUP" can be placed side-by-side using the letters from
>> 
>> the sentence.
>> 
>> 
>> Constraints
>> 
>> 
>> 1 < T ≤ 20
>> 
>> Sentences contain only the upper-case letters A-Z and the space character
>> 
>> Each sentence contains at least one letter, and contains at most 1000
>> 
>> characters, including spaces
>> 
>> 
>> 
>> Eu anexei o input "alphabet_soup.txt" ,a saida "certo.txt" e o meu script
>> 
>> "script.pl".
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> --
>> 
>> Software Engineer
>> 
>> Just Another Perl Hacker
>> 
>> Daniel Mantovani +5511 8538-9897
>> 
>> XOXO
>> 
>> 
>> 
>> =begin disclaimer
>> 
>>   Sao Paulo Perl Mongers: http://sao-paulo.pm.org/
>> 
>>  SaoPaulo-pm mailing list: SaoPaulo-pm em pm.org
>> 
>>  L<http://mail.pm.org/mailman/listinfo/saopaulo-pm>
>> 
>> =end disclaimer
>> 
>> 
>> 
>> 
>> 
>> --
>> Tiago B. Peczenyj
>> Linux User #405772
>> 
>> http://pacman.blog.br
>> =begin disclaimer
>>   Sao Paulo Perl Mongers: http://sao-paulo.pm.org/
>> SaoPaulo-pm mailing list: SaoPaulo-pm em pm.org
>> L<http://mail.pm.org/mailman/listinfo/saopaulo-pm>
>> =end disclaimer
>> 
>> 
>> 
>> =begin disclaimer
>>   Sao Paulo Perl Mongers: http://sao-paulo.pm.org/
>>  SaoPaulo-pm mailing list: SaoPaulo-pm em pm.org
>>  L<http://mail.pm.org/mailman/listinfo/saopaulo-pm>
>> =end disclaimer
>> 
> 
> 
> 
> -- 
> Tiago B. Peczenyj
> Linux User #405772
> 
> http://pacman.blog.br
> =begin disclaimer
>   Sao Paulo Perl Mongers: http://sao-paulo.pm.org/
> SaoPaulo-pm mailing list: SaoPaulo-pm em pm.org
> L<http://mail.pm.org/mailman/listinfo/saopaulo-pm>
> =end disclaimer

-------------- Pr�xima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/saopaulo-pm/attachments/20120130/c62b617e/attachment-0001.html>


More information about the SaoPaulo-pm mailing list