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

#include <leetcode.h>

静态 Public 成员函数

static int countEven (int num)
 

详细描述

在文件 leetcode.h1261 行定义.

成员函数说明

◆ countEven()

int leetcode::count_integers_with_even_digit_sum::Solution::countEven ( int  num)
static

在文件 leetcode.cpp3173 行定义.

3173 {
3174 int ans = 0;
3175 for(int i = 1; i <= num; i++) {
3176 stringstream ss;
3177 ss << i;
3178 char ch;
3179 int sum = 0;
3180 while(ss >> ch) {
3181 sum += ch - '0';
3182 }
3183 if(sum % 2 == 0) {
3184 ans++;
3185 }
3186 }
3187 return ans;
3188 }

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


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