File tree Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "bufio"
5
+ . "fmt"
6
+ "io"
7
+ "math/bits"
8
+ )
9
+
10
+ // github.com/EndlessCheng/codeforces-go
11
+ func CF467B (_r io.Reader , out io.Writer ) {
12
+ in := bufio .NewReader (_r )
13
+ var n , m , k , v , ans uint
14
+ Fscan (in , & n , & m , & k )
15
+ a := make ([]uint , m )
16
+ for i := range a {
17
+ Fscan (in , & a [i ])
18
+ }
19
+ Fscan (in , & v )
20
+
21
+ for _ , w := range a {
22
+ if uint (bits .OnesCount (v ^ w )) <= k {
23
+ ans ++
24
+ }
25
+ }
26
+ Fprint (out , ans )
27
+ }
28
+
29
+ //func main() { CF467B(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/467/B
9
+ // https://codeforces.com/problemset/status/467/problem/B
10
+ func TestCF467B (t * testing.T ) {
11
+ // just copy from website
12
+ rawText := `
13
+ inputCopy
14
+ 7 3 1
15
+ 8
16
+ 5
17
+ 111
18
+ 17
19
+ outputCopy
20
+ 0
21
+ inputCopy
22
+ 3 3 3
23
+ 1
24
+ 2
25
+ 3
26
+ 4
27
+ outputCopy
28
+ 3
29
+ inputCopy
30
+ 6 8 2
31
+ 46
32
+ 59
33
+ 38
34
+ 5
35
+ 13
36
+ 54
37
+ 26
38
+ 62
39
+ 18
40
+ outputCopy
41
+ 2`
42
+ testutil .AssertEqualCase (t , rawText , 0 , CF467B )
43
+ }
You can’t perform that action at this time.
0 commit comments