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.
42 lines
558 B
42 lines
558 B
package correct |
|
|
|
import "fmt" |
|
|
|
func drawLineRaid1e(x int, s string) { |
|
beg := s[0] |
|
med := s[1] |
|
end := s[2] |
|
if x >= 1 { |
|
fmt.Printf("%c", beg) |
|
} |
|
if x > 2 { |
|
for i := 0; i < (x - 2); i++ { |
|
fmt.Printf("%c", med) |
|
} |
|
} |
|
if x > 1 { |
|
fmt.Printf("%c", end) |
|
} |
|
fmt.Println() |
|
} |
|
|
|
func Raid1e(x, y int) { |
|
if x < 1 || y < 1 { |
|
return |
|
} |
|
strBeg := "ABC" |
|
strMed := "B B" |
|
strEnd := "CBA" |
|
|
|
if y >= 1 { |
|
drawLineRaid1e(x, strBeg) |
|
} |
|
if y > 2 { |
|
for i := 0; i < y-2; i++ { |
|
drawLineRaid1e(x, strMed) |
|
} |
|
} |
|
if y > 1 { |
|
drawLineRaid1e(x, strEnd) |
|
} |
|
}
|
|
|