Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "strconv"
- )
- func main() {
- var availableArea, currentSuitcaseArea float64
- fmt.Scanln(&availableArea)
- loadedSuitcases := 0
- var input string
- fmt.Scanln(&input)
- for input != "End" {
- currentSuitcaseArea,_ = strconv.ParseFloat(input, 64)
- loadedSuitcases++
- if loadedSuitcases % 3 == 0 {
- currentSuitcaseArea *= 1.1
- }
- if (currentSuitcaseArea > availableArea) {
- fmt.Println("No more space!")
- loadedSuitcases--
- break
- }
- availableArea -= currentSuitcaseArea
- fmt.Scanln(&input)
- }
- if input == "End" {
- fmt.Println("Congratulations! All suitcases are loaded!")
- }
- fmt.Printf("Statistic: %d suitcases loaded.", loadedSuitcases)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement