Add OpenMP support. Doesnt really matter but why not
This commit is contained in:
@@ -6,6 +6,14 @@
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
|
||||
#ifdef _MSVC
|
||||
#define _OPENMP 1
|
||||
#endif
|
||||
|
||||
#ifdef _OPENMP
|
||||
#include <omp.h>
|
||||
#endif
|
||||
|
||||
class Range {
|
||||
public:
|
||||
using range_t = long long;
|
||||
@@ -123,6 +131,9 @@ public:
|
||||
auto left = range.left();
|
||||
auto right = range.right();
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for reduction(+ : sum)
|
||||
#endif
|
||||
for (Range::range_t i = left; i <= right; i++) {
|
||||
if (!isValidPart02(std::to_string(i)))
|
||||
sum += i;
|
||||
|
||||
Reference in New Issue
Block a user