package main import "fmt" const ( LIMITE = 0.99 ) func isBouncy( a int ) int { if a < 101 { return 0; } c, d := 0, 0 inc := 0 for c == d && a != 0 { d = a % 10 a /= 10 c = a % 10 } if c == d { return 2; } if c < d { inc = 1 for c <= d && a != 0 { d = a % 10 a /= 10 c = a % 10 } } else { inc = -1 for c >= d && a != 0 { d = a % 10 a /= 10 c = a % 10 } } if( a == 0 ) { return inc } else { return 0 } } func main() { tot := 0 i := 0 inc := 0 dec := 0 bon := 0 for i = 0 ; i < 10000 ; i++ { if isBouncy(i) < 0 { dec++ } else if isBouncy(i) == 0 { bon++ } else if isBouncy(i) == 1 { inc++ } else { dec++ inc++ } tot+=1. } fmt.Println(dec); fmt.Println(inc); fmt.Println(bon); fmt.Println(tot-bon); fmt.Println(tot); }