Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <chrono>
- #include <ctime>
- #include <thread>
- #define n 625000000
- using namespace std;
- long double sum = 0;
- void summa(/*long long &n*/) {
- for (long long i = 1; i < n; i++) {
- sum += (i&1 == 0 ? 1 : -1)*log(i) / i;
- }
- }
- int main()
- {
- // long long n = 62500000000;
- std::chrono::time_point<std::chrono::system_clock> start, end;
- start = std::chrono::system_clock::now();
- summa(/*n*/);
- end = std::chrono::system_clock::now();
- int elapsed_seconds =
- std::chrono::duration_cast<std::chrono::milliseconds>
- (end - start).count();
- std::time_t end_time = std::chrono::system_clock::to_time_t(end);
- cout << sum << endl;
- std::cout << "finished computation at " << std::ctime(&end_time)
- << "elapsed time: " << elapsed_seconds << "ms\n";
- return 0;
- }
- /*
- вариант 5
- O2/:
- x86:
- 26455 - debug
- 6987 - release
- x64:
- 20984 - debug
- 4234 - release
- intel compiler release:
- x86 - 11305
- x64 - 3239
- O1/:
- x86 - 17543
- x64 - 5032
- O3/:
- x86 - 11253
- x64 - 3258
- avx:
- x86 - 8012
- x64 - 3312
- parall:
- x86 - 2136
- x64 - 539
- загрузка процессора - 25%
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement