Advertisement
Spocoman

Renovation

Oct 12th, 2024
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.81 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.   "fmt"
  5.   "math"
  6.   "strconv"
  7. )
  8.  
  9. func main() {
  10.     var x, y, nonPaint, paint int
  11.     fmt.Scanln(&x)
  12.     fmt.Scanln(&y)
  13.     fmt.Scanln(&nonPaint)
  14.    
  15.     neededPaint := 1.0 * x * y * 4 * (100.0 - nonPaint) / 100
  16.  
  17.     var command string
  18.     fmt.Scanln(&command)
  19.    
  20.     for command != "Tired!" {
  21.         paint,_ = strconv.Atoi(command)
  22.         neededPaint -= paint
  23.         if neededPaint <= 0 {
  24.             break
  25.         }
  26.         fmt.Scanln(&command)
  27.     }
  28.  
  29.     if neededPaint > 0 {
  30.         fmt.Printf("%d quadratic m left.\n", neededPaint)
  31.     } else if neededPaint == 0 {
  32.         fmt.Println("All walls are painted! Great job, Pesho!")
  33.     } else {
  34.         fmt.Printf("All walls are painted and you have %d l paint left!\n", int(math.Abs(float64(neededPaint))))
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement