[SP-pm] Ler o stdin para uma string

Pinguim Azul bluepenguin at gmail.com
Tue Jul 20 06:18:01 PDT 2010


No spoj tem um para achar o n-esimo fibonacci:

http://www.spoj.pl/SHORTEN/problems/FIBON/

2010/7/20 Daniel de Oliveira Mantovani <daniel.oliveira.mantovani at gmail.com>:
> Pinguem, olha que maneiro essa seqüencia de Fibonacci:
>
> $_="$':".($'+$`||1),say$`while x./:/
>
> http://mark.aufflick.com/blog/2008/10/05/fibonacci-perl-golf
>
>
>
> 2010/7/19 Pinguim Azul <bluepenguin at gmail.com>:
>> Usando esse truque do shebang eu ganhei 5 chars no MORSE_CD :)
>>
>> https://www.spoj.pl/SHORTEN/status/MORSE_CD,ricbit/
>>
>> 2010/7/19 Eden Cardim <edencardim at gmail.com>:
>>>>>>>> "Pinguim" == Pinguim Azul <bluepenguin at gmail.com> writes:
>>>
>>>    Pinguim> $t.=$_ for<>
>>>
>>> Se me lembro bem acho que você pode usar a construção shebang para
>>> passar opções de linha de comando no SPOJ, isso vai colocar o STDIN na
>>> variável $_
>>>
>>> #!perl -0n
>>>
>>> 11 caracteres (contando com o newline no final), pode valer mais a pena
>>> se tiver outras opções para usar e amortizar o custo do #!perl
>>> _______________________________________________
>>> SaoPaulo-pm mailing list
>>> SaoPaulo-pm at pm.org
>>> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>>
>>
>>
>> --
>> Ricardo Bittencourt
>> http://www.ricbit.com
>> _______________________________________________
>> SaoPaulo-pm mailing list
>> SaoPaulo-pm at 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."
> _______________________________________________
> SaoPaulo-pm mailing list
> SaoPaulo-pm at pm.org
> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>



-- 
Ricardo Bittencourt
http://www.ricbit.com


More information about the SaoPaulo-pm mailing list