Advertisement
Spocoman

Movie Stars

Oct 11th, 2024
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.77 KB | None | 0 0
  1. package main
  2.  
  3.  import (
  4.     "bufio"
  5.     "fmt"
  6.     "os"
  7.     "math"
  8.     "strconv"
  9. )
  10.  
  11. func main() {
  12.     scanner := bufio.NewScanner(os.Stdin)
  13.     scanner.Scan()
  14.     budget,_ := strconv.ParseFloat(scanner.Text(), 64)
  15.    
  16.     var salary float64
  17.  
  18.     scanner.Scan()
  19.     actor := scanner.Text()
  20.    
  21.     for budget >= 0 && actor != "ACTION" {
  22.         if len(actor) <= 15 {
  23.             salary,_ = strconv.ParseFloat(scanner.Text(), 64)
  24.             budget -= salary
  25.         } else {
  26.                 budget *= 0.8
  27.         }
  28.         scanner.Scan()
  29.         actor = scanner.Text()
  30.     }
  31.  
  32.     if budget < 0 {
  33.         fmt.Printf("We need %.2f leva for our actors.\n", math.Abs(budget))
  34.     } else {
  35.         fmt.Printf("We are left with %.2f leva.\n", budget)
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement