File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ . "fmt"
5
+ "io"
6
+ )
7
+
8
+ // github.com/EndlessCheng/codeforces-go
9
+ func CF771B (in io.Reader , out io.Writer ) {
10
+ var n , k int
11
+ var s string
12
+ Fscan (in , & n , & k )
13
+ a := make ([][]byte , n )
14
+ for i := 0 ; i < k - 1 ; i ++ {
15
+ a [i ] = []byte {'A' + byte (i / 26 ), 'a' + byte (i % 26 )}
16
+ }
17
+ for i := k - 1 ; i < n ; i ++ {
18
+ if Fscan (in , & s ); s [0 ] == 'Y' {
19
+ a [i ] = []byte {'A' + byte (i / 26 ), 'a' + byte (i % 26 )}
20
+ } else {
21
+ a [i ] = a [i - k + 1 ]
22
+ }
23
+ }
24
+ for _ , v := range a {
25
+ Fprintf (out , "%s " , v )
26
+ }
27
+ }
28
+
29
+ //func main() { CF771B(os.Stdin, os.Stdout) }
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "github.com/EndlessCheng/codeforces-go/main/testutil"
5
+ "testing"
6
+ )
7
+
8
+ // https://codeforces.com/problemset/problem/771/B
9
+ // https://codeforces.com/problemset/status/771/problem/B
10
+ func TestCF771B (t * testing.T ) {
11
+ // just copy from website
12
+ rawText := `
13
+ inputCopy
14
+ 8 3
15
+ NO NO YES YES YES NO
16
+ outputCopy
17
+ Adam Bob Bob Cpqepqwer Limak Adam Bob Adam
18
+ inputCopy
19
+ 9 8
20
+ YES NO
21
+ outputCopy
22
+ R Q Ccccccccc Ccocc Ccc So Strong Samples Ccc
23
+ inputCopy
24
+ 3 2
25
+ NO NO
26
+ outputCopy
27
+ Na Na Na`
28
+ testutil .AssertEqualCase (t , rawText , 0 , CF771B )
29
+ }
You can’t perform that action at this time.
0 commit comments