Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "math"
- )
- func main() {
- var basis, size, step int
- fmt.Scanln(&basis)
- var increment, stone, marble, lapis, gold, decorate float64
- fmt.Scanln(&increment)
- for i := basis; i > 0; i -= 2 {
- size = i * i
- step++
- if i < 3 {
- gold = float64(size) * increment
- } else {
- stone += float64((i - 2) * (i - 2)) * increment
- decorate = float64(i * 4 - 4) * increment
- if step % 5 != 0 {
- marble += decorate
- } else {
- lapis += decorate
- }
- }
- }
- fmt.Printf("Stone required: %d\nMarble required: %d\nLapis Lazuli required: %d\nGold required: %d\nFinal pyramid height: %d\n",
- int(math.Ceil(stone)), int(math.Ceil(marble)), int(math.Ceil(lapis)), int(math.Ceil(gold)), int(float64(step) * increment))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement