Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "math"
- )
- func main() {
- var quantity, sugar, flour, maxSugar, maxFlour, totalSugar, totalFlour int
- fmt.Scanln(&quantity)
- for i := 0; i < quantity; i++ {
- fmt.Scanln(&sugar)
- fmt.Scanln(&flour)
- if maxSugar < sugar {
- maxSugar = sugar
- }
- if maxFlour < flour {
- maxFlour = flour
- }
- totalSugar += sugar
- totalFlour += flour
- }
- fmt.Printf("Sugar: %d\nFlour: %d\nMax used flour is %d grams, max used sugar is %d grams.\n",
- int(math.Ceil(float64(totalSugar) / 950)), int(math.Ceil(float64(totalFlour) / 750)), maxFlour, maxSugar)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement