Primes whose sum of digits is 25: Difference between revisions
m
C++ - minor performance improvement
(→Stretch Goal: typo) |
m (C++ - minor performance improvement) |
||
Line 204:
}
int count = 0;▼
if (rem == 0) {
switch (str.back()) {
Line 219 ⟶ 220:
} else {
for (int i = 1; i <= std::min(9, rem); ++i)
count += count_all(str +
}
return count;
}
Line 236 ⟶ 238:
std::cout << '\n';
▲ count = 0;
auto start = std::chrono::steady_clock::now();
count = count_all("", 25
auto end = std::chrono::steady_clock::now();
std::cout << "\nThere are " << count
|