Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var jumpTarget, jump, counter, fall int
- fmt.Scanln(&jumpTarget)
- startJump := jumpTarget - 30
- for fall != 3 && startJump <= jumpTarget {
- fmt.Scanln(&jump)
- if jump > startJump {
- startJump += 5
- fall = 0
- } else {
- fall++
- }
- counter++
- }
- if startJump <= jumpTarget {
- fmt.Printf("Tihomir failed at %dcm after %d jumps.", startJump, counter)
- } else {
- fmt.Printf("Tihomir succeeded, he jumped over %dcm after %d jumps.", jumpTarget, counter)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement