Example code:
template<typename T>
inline void Solution() {
T n = 0;
T k = 0;
T s = 1;
while (k < 500) {
n += s++;
k = 2;
T lim = n;
for (T i = 2; i < lim; i++) {
if (n % i == 0) {
lim = n / i;
k += 2;
}
}
}
std::cout << "index: " << s << std::endl;
std::cout << "value: " << n << std::endl;
}
There is a difference between calculation time when i use int32_t and int64_t (more then 2x times). So, simple question is: "Why?"
Solution<int32_t> -> 0.35s on x32 build
Solution<int64_t> -> 0.75s on x32 build