mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
552 B
27 lines
552 B
5 years ago
|
package main
|
||
5 years ago
|
|
||
|
import (
|
||
5 years ago
|
"math"
|
||
|
|
||
5 years ago
|
"./student"
|
||
5 years ago
|
)
|
||
|
|
||
5 years ago
|
func recursivePower(nb, power int) int {
|
||
|
if power < 0 {
|
||
|
return 0
|
||
|
}
|
||
|
return int(math.Pow(float64(nb), float64(power)))
|
||
|
}
|
||
|
|
||
5 years ago
|
func main() {
|
||
5 years ago
|
i := 0
|
||
|
for i < 30 {
|
||
5 years ago
|
nb := lib.RandIntBetween(-8, 8)
|
||
|
power := lib.RandIntBetween(-10, 10)
|
||
5 years ago
|
lib.Challenge("RecursivePower", student.RecursivePower, recursivePower, nb, power)
|
||
5 years ago
|
i++
|
||
|
}
|
||
5 years ago
|
lib.Challenge("RecursivePower", student.RecursivePower, correct.RecursivePower, 0, 0)
|
||
|
lib.Challenge("RecursivePower", student.RecursivePower, correct.RecursivePower, 0, 1)
|
||
5 years ago
|
}
|