Skip to content

Commit

Permalink
CF1064B
Browse files Browse the repository at this point in the history
  • Loading branch information
EndlessCheng committed Feb 18, 2024
1 parent 646deb9 commit c298b50
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
18 changes: 18 additions & 0 deletions main/1000-1099/1064B.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

import (
. "fmt"
"io"
"math/bits"
)

// https://space.bilibili.com/206214
func cf1064B(in io.Reader, out io.Writer) {
var T, n uint
for Fscan(in, &T); T > 0; T-- {
Fscan(in, &n)
Fprintln(out, 1<<bits.OnesCount(n))
}
}

//func main() { cf1064B(os.Stdin, os.Stdout) }
24 changes: 24 additions & 0 deletions main/1000-1099/1064B_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Generated by copypasta/template/generator_test.go
package main

import (
"github.com/EndlessCheng/codeforces-go/main/testutil"
"testing"
)

// http://codeforces.com/problemset/problem/1064/B
// https://codeforces.com/problemset/status/1064/problem/B
func Test_cf1064B(t *testing.T) {
testCases := [][2]string{
{
`3
0
2
1073741823`,
`1
2
1073741824`,
},
}
testutil.AssertEqualStringCase(t, testCases, 0, cf1064B)
}

0 comments on commit c298b50

Please sign in to comment.