Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "bufio"
- "fmt"
- "os"
- "math"
- "strconv"
- )
- func main() {
- scanner := bufio.NewScanner(os.Stdin)
- scanner.Scan()
- budget,_ := strconv.ParseFloat(scanner.Text(), 64)
- var salary float64
- scanner.Scan()
- actor := scanner.Text()
- for budget >= 0 && actor != "ACTION" {
- if len(actor) <= 15 {
- salary,_ = strconv.ParseFloat(scanner.Text(), 64)
- budget -= salary
- } else {
- budget *= 0.8
- }
- scanner.Scan()
- actor = scanner.Text()
- }
- if budget < 0 {
- fmt.Printf("We need %.2f leva for our actors.\n", math.Abs(budget))
- } else {
- fmt.Printf("We are left with %.2f leva.\n", budget)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement