Skip to content

Instantly share code, notes, and snippets.

@yashigani
Last active December 15, 2015 23:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yashigani/5340466 to your computer and use it in GitHub Desktop.
Save yashigani/5340466 to your computer and use it in GitHub Desktop.
すごいH本読書会 #1 練習問題

以下の関数を定義しなさい

  • null
  • sum
  • product
  • elem
  • Pythonのスライス
    • ex) slice 2 5 [1..7] # => [3, 4, 5]
  • フィボナッチ数列のn番目の数を返す関数
  • FizzBuzzのn項目からm項目までを返す関数

以下に示す,「良い整数」のうち一の位が0でないものを3桁の整数の中から4つ探しなさい

  • 3けたの整数を2つの整数に分けてその和を考えると,常にもとの整数の約数になっている
  • 330は3と30に分けても,33と0に分けても和が330の約数になっています.このため,330は「良い整数」となります.ですが,702は7と02に分けた場合は約数になりますが,70と2に分けてしまうと約数になりません.よって,702は「良い整数」ではありません
null' :: [a] -> Bool
sum' :: [Int] -> Int
product' :: [Int] -> Int
elem' :: (Eq a) => a -> [a] -> Bool
slice :: Int -> Int -> [a] -> [a]
goodNumbers :: [Int]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment