problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::prime_number_of_set_bits_in_binary_representation::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static int countPrimeSetBits (int left, int right)
 

详细描述

在文件 leetcode.h2117 行定义.

成员函数说明

◆ countPrimeSetBits()

int leetcode::prime_number_of_set_bits_in_binary_representation::Solution::countPrimeSetBits ( int  left,
int  right 
)
static

在文件 leetcode.cpp5723 行定义.

5723 {
5724 int ans = 0;
5725 const unordered_set primes{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61};
5726 for(unsigned i = left; i <= right; i++) {
5727 if(primes.contains(popcount(i))) {
5728 ans++;
5729 }
5730 }
5731 return ans;
5732 }

引用了 acwing::acwing1929::left , 以及 acwing::acwing1929::right.

被这些函数引用 leetcode::prime_number_of_set_bits_in_binary_representation::TEST().


该类的文档由以下文件生成: