Skip to main content
Code Review

Return to Question

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link
  1. using std::cout << "\n" instead of std::cout << endl to prevent flushing output buffers. Source: this this
  2. using inline void triangle(int &num, int &interval) speed up 10% time
  3. using n(n+1)/2 according to this this
  1. using std::cout << "\n" instead of std::cout << endl to prevent flushing output buffers. Source: this
  2. using inline void triangle(int &num, int &interval) speed up 10% time
  3. using n(n+1)/2 according to this
  1. using std::cout << "\n" instead of std::cout << endl to prevent flushing output buffers. Source: this
  2. using inline void triangle(int &num, int &interval) speed up 10% time
  3. using n(n+1)/2 according to this
edited tags
Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238
deleted 12 characters in body; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

C++ Project Euler #12 optimization- highly divisible triangular number

The code takes far too long to complete (over 10 minutes). Is there any way to optimize the run-time? And, and to make it more elegant?

So I only need to iterate up to half of the limit. But how can I implement that into my code? to only iterate up to half as many factor. Thankyou?

C++ Project Euler #12 optimization

The code takes far too long to complete (over 10 minutes). Is there any way to optimize the run-time? And, to make it more elegant?

So I only need to iterate up to half of the limit. But how can I implement that into my code? to only iterate up to half as many factor. Thankyou

Project Euler #12 - highly divisible triangular number

The code takes far too long to complete (over 10 minutes). Is there any way to optimize the run-time and to make it more elegant?

So I only need to iterate up to half of the limit. But how can I implement that into my code to only iterate up to half as many factor?

link to and explain the problem description
Source Link
Loading
Source Link
Loading
lang-cpp

AltStyle によって変換されたページ (->オリジナル) /