Advertisement
Spocoman

Happy Cat Parking

Oct 10th, 2024
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.60 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var days, hours int
  7.     fmt.Scanln(&days)
  8.     fmt.Scanln(&hours)
  9.  
  10.     total := 0.0
  11.  
  12.     for day := 1; day <= days; day++ {
  13.         sum := 0.0
  14.         for hour := 1; hour <= hours; hour++ {
  15.             if day % 2 == 0 && hour % 2 == 1 {
  16.                 sum += 2.50
  17.             } else if day % 2 == 1 && hour % 2 == 0 {
  18.                 sum += 1.25
  19.             } else {
  20.                 sum++;
  21.             }
  22.         }
  23.         fmt.Printf("Day: %d - %.2f leva\n", day, sum)
  24.         total += sum
  25.     }
  26.  
  27.     fmt.Printf("Total: %.2f leva\n", total)
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement