Skip to content

Instantly share code, notes, and snippets.

@takoika
Last active February 26, 2016 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takoika/1c90994f735015de5a09 to your computer and use it in GitHub Desktop.
Save takoika/1c90994f735015de5a09 to your computer and use it in GitHub Desktop.
バイバイマンを数えよう(https://codeiq.jp/q/2593). Python2(51), Python3(52), Go(127), Scala(96).
package main
import "fmt";func main(){a:=[200]uint64{1,1,1,1,2}
for i:=0;i<100;i++{fmt.Println(a[i])
a[i+5]=a[i]+2*a[i+1])}}
object Main extends App{var a=Seq(1L,1,1,1,2);for(i<-0 to 99){println(a(i));a=a:+a(i)+2*a(i+1)}}
C=[2]+[1]*4;exec'print C[4];C=[C[4]+2*C[3]]+C;'*100
C=[2]+[1]*4;exec('print(C[4]);C=[C[4]+2*C[3]]+C;'*100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment