[SP-pm] Dúvida com Hash Slices

Daniel de Oliveira Mantovani daniel.oliveira.mantovani at gmail.com
Sun Jul 25 12:14:17 PDT 2010


Ah, resolvi com 37 caracteres,
map{$_=<>;/-/||($a+=$_)}1..<>;print$a

2010/7/25 Daniel de Oliveira Mantovani <daniel.oliveira.mantovani em gmail.com>:
> 2010/7/25 Renato Santos <renato.cron em gmail.com>:
>> Como que 4+5+6 é 11?
>
> O 4 é o número de testes,
> 4 - numero de testes
> 5 - teste 1
> -5 - teste 2
> 6 - teste 3
> -1 - teste 4
>
> 5+6=11
>
> Pelo que eu entendi, o número de input está ultrapassando o número de
> testes. (t – number of test cases)
> 4 - numero de testes
> 5 - teste 1
> -5 - teste 2
> 6 - teste 3
> -1 - teste 4
> --ignore o que vem aqui--
> -10 - ignorar...
> 10 - ignorar
>
>>
>> 2010/7/25 Pinguim Azul <bluepenguin em gmail.com>
>>>
>>> 2010/7/25 Daniel de Oliveira Mantovani
>>> <daniel.oliveira.mantovani em gmail.com>:
>>> > 2010/7/25 Pinguim Azul <bluepenguin em gmail.com>:
>>> >> Eu acho os exemplos do SPOJ sempre muito bons, qual descrição você
>>> >> achou deficiente?
>>> >
>>> > https://www.spoj.pl/SHORTEN/problems/SIZECON/
>>> >
>>> > <>;$_>=0&&($a+=$_)for<>;print$a,$/
>>> >
>>> > E meu amigo no IRC, escreveu algo assim,
>>> > <>;/-/||($a+=$_)for<>;print$a,$/
>>>
>>> Nenhum dos dois vai funcionar, porque vocês ignoraram o primeiro
>>> número. Para esse caso aqui dá problema:
>>>
>>> 3
>>> 1
>>> 1
>>> 1
>>> 2
>>> 2
>>> 3
>>>
>>> Mas para treinar algoritmos o melhor é o SPOJ normal, não o de shortest
>>> code:
>>>
>>> http://www.spoj.pl/
>>>
>>> --
>>> Ricardo Bittencourt
>>> http://www.ricbit.com
>>> _______________________________________________
>>> SaoPaulo-pm mailing list
>>> SaoPaulo-pm em pm.org
>>> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>>
>>
>>
>> --
>> Renato Santos
>> http://www.renatocron.com/blog/
>>
>> _______________________________________________
>> SaoPaulo-pm mailing list
>> SaoPaulo-pm em pm.org
>> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>>
>
>
>
> --
> http://www.danielmantovani.com
>
> "If you’ve never written anything thoughtful, then you’ve never had
> any difficult, important, or interesting thoughts. That’s the secret:
> people who don’t write, are people who don’t think."
>



-- 
http://www.danielmantovani.com

"If you’ve never written anything thoughtful, then you’ve never had
any difficult, important, or interesting thoughts. That’s the secret:
people who don’t write, are people who don’t think."


More information about the SaoPaulo-pm mailing list