Advertisement
Spocoman

The Pyramid Of King Djoser

Oct 13th, 2024
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.92 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.   "fmt"
  5.   "math"
  6. )
  7.  
  8. func main() {
  9.     var basis, size, step int
  10.     fmt.Scanln(&basis)
  11.    
  12.     var increment, stone, marble, lapis, gold, decorate float64
  13.     fmt.Scanln(&increment)
  14.  
  15.     for i := basis; i > 0; i -= 2 {
  16.         size = i * i
  17.         step++
  18.         if i < 3 {
  19.             gold = float64(size) * increment
  20.         } else {
  21.             stone += float64((i - 2) * (i - 2)) * increment
  22.             decorate = float64(i * 4 - 4) * increment
  23.             if step % 5 != 0 {
  24.                 marble += decorate
  25.             } else {
  26.                 lapis += decorate
  27.             }
  28.         }
  29.     }
  30.  
  31.     fmt.Printf("Stone required: %d\nMarble required: %d\nLapis Lazuli required: %d\nGold required: %d\nFinal pyramid height: %d\n",
  32.                     int(math.Ceil(stone)), int(math.Ceil(marble)), int(math.Ceil(lapis)), int(math.Ceil(gold)), int(float64(step) * increment))
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement