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.
56 lines
1.0 KiB
56 lines
1.0 KiB
5 years ago
|
package main
|
||
|
|
||
5 years ago
|
import "../lib"
|
||
5 years ago
|
|
||
5 years ago
|
func main() {
|
||
5 years ago
|
table := []string{
|
||
5 years ago
|
"CDCCDDCDCD",
|
||
|
"CDDDDCCCDC",
|
||
|
"DDDDCCCC",
|
||
|
"CDCCCDDCDD",
|
||
|
"CDCDCDCDCDCDCDCD",
|
||
|
"CCCDDDCDCCCCDC",
|
||
|
"DDDDDDDDDDDDDDDDDDDDDDDDCCCCCCCCCCCCCCCCCCCCCCCC",
|
||
|
"DDDDCDDDDCDDDCCC",
|
||
5 years ago
|
}
|
||
5 years ago
|
|
||
|
for i := 0; i < 15; i++ {
|
||
5 years ago
|
s := ""
|
||
5 years ago
|
chunks := lib.RandIntBetween(5, 10)
|
||
5 years ago
|
for j := 0; j < chunks; j++ {
|
||
5 years ago
|
countC := lib.RandIntBetween(1, 5)
|
||
|
countD := lib.RandIntBetween(1, 5)
|
||
5 years ago
|
tmpC := countC
|
||
|
tmpD := countD
|
||
|
for tmpC > 0 || tmpD > 0 {
|
||
5 years ago
|
letter := lib.RandStr(1, "CD")
|
||
5 years ago
|
if tmpC > 0 && letter == "C" {
|
||
|
tmpC--
|
||
5 years ago
|
s += letter
|
||
5 years ago
|
} else if tmpD > 0 && letter == "D" {
|
||
|
tmpD--
|
||
5 years ago
|
s += letter
|
||
5 years ago
|
}
|
||
|
}
|
||
|
|
||
|
tmpC = countC
|
||
|
tmpD = countD
|
||
|
for tmpC > 0 || tmpD > 0 {
|
||
5 years ago
|
letter := lib.RandStr(1, "CD")
|
||
5 years ago
|
if tmpC > 0 && letter == "D" {
|
||
|
tmpC--
|
||
5 years ago
|
s += letter
|
||
5 years ago
|
} else if tmpD > 0 && letter == "C" {
|
||
|
tmpD--
|
||
5 years ago
|
s += letter
|
||
5 years ago
|
}
|
||
|
}
|
||
|
}
|
||
5 years ago
|
table = append(table, s)
|
||
5 years ago
|
}
|
||
|
|
||
|
for _, arg := range table {
|
||
5 years ago
|
lib.ChallengeMain("balancedstring", arg)
|
||
5 years ago
|
}
|
||
|
}
|