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.
29 lines
641 B
29 lines
641 B
package main |
|
|
|
import ( |
|
"strconv" |
|
"strings" |
|
|
|
"./student" |
|
) |
|
|
|
func itoaBase(value, base int) string { |
|
if base < 2 || base > 16 { |
|
return "" |
|
} |
|
|
|
return strings.ToUpper(strconv.FormatInt(int64(value), base)) |
|
} |
|
|
|
func main() { |
|
for i := 0; i < 30; i++ { |
|
value := lib.RandIntBetween(-1000000, 1000000) |
|
base := lib.RandIntBetween(2, 16) |
|
lib.Challenge("ItoaBase", student.ItoaBase, itoaBase, value, base) |
|
} |
|
for i := 0; i < 5; i++ { |
|
base := lib.RandIntBetween(2, 16) |
|
lib.Challenge("ItoaBase", student.ItoaBase, correct.ItoaBase, lib.MaxInt, base) |
|
lib.Challenge("ItoaBase", student.ItoaBase, correct.ItoaBase, lib.MinInt, base) |
|
} |
|
}
|
|
|