Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "math"
- )
- func main() {
- var x int
- fmt.Scanln(&x)
- var y float64
- fmt.Scanln(&y)
- var z, workers int
- fmt.Scanln(&z)
- fmt.Scanln(&workers)
- var wine = 0.4 * float64(x) * y / 2.5;
- if (wine < float64(z)) {
- fmt.Printf("It will be a tough winter! More %d liters wine needed.", (int)(float64(z) - wine))
- } else {
- fmt.Printf("Good harvest this year! Total wine: %d liters.\n", (int)(wine))
- fmt.Printf("%d liters left -> %d liters per person.",
- (int)(math.Ceil(wine - float64(z))), (int)(math.Ceil((wine - float64(z)) / float64(workers))))
- }
- }
- ИЛИ:
- package main
- import (
- "fmt"
- "math"
- )
- func main() {
- var x, y, z, workers float64
- fmt.Scanln(&x)
- fmt.Scanln(&y)
- fmt.Scanln(&z)
- fmt.Scanln(&workers)
- var wine = 0.4 * x * y / 2.5;
- if (wine < z) {
- fmt.Printf("It will be a tough winter! More %d liters wine needed.", int(z - wine))
- } else {
- fmt.Printf("Good harvest this year! Total wine: %d liters.\n%d liters left -> %d liters per person.",
- int(wine), int(math.Ceil(wine - z)), int(math.Ceil((wine - z) / workers)))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement