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 "github.com/01-edu/z01"
|
||
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 := z01.RandIntBetween(5, 10)
|
||
|
for j := 0; j < chunks; j++ {
|
||
|
countC := z01.RandIntBetween(1, 5)
|
||
|
countD := z01.RandIntBetween(1, 5)
|
||
|
tmpC := countC
|
||
|
tmpD := countD
|
||
|
for tmpC > 0 || tmpD > 0 {
|
||
|
letter := z01.RandStr(1, "CD")
|
||
|
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 {
|
||
|
letter := z01.RandStr(1, "CD")
|
||
|
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
|
z01.ChallengeMain("balancedstring", arg)
|
||
5 years ago
|
}
|
||
|
}
|