Created
February 16, 2018 18:40
-
-
Save AnthonyMikh/d7e7c0a8d036378cd0dc528f3596ed4e to your computer and use it in GitHub Desktop.
Решение задачи №71
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Считает сумму первых n членов арифметической прогрессии | |
--с разностью d и первым членом n0 | |
ariphmSum d n0 n = ((2*n0 + d*(n-1))*n) `div` 2 | |
treeWater = (+top) . ariphmSum tierDiff initLeaves | |
where | |
top = 1 | |
tierDiff = 2 | |
initLeaves = 2 | |
main = print . treeWater $ 4 | |
-- > 21 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Playground: https://repl.it/repls/SpitefulDrearyUsername