Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4. #include <vector>
  5. #include <cmath>
  6. #include <random>
  7. #include <ctime>
  8. #include <ratio>
  9. #include <chrono>
  10. #include <fstream>
  11. using namespace std;
  12. using namespace std::chrono;
  13.  
  14. mt19937 gen(55);
  15.  
  16.  
  17. void test(int razmer_vectorov_kotorie_anya_budet_peremnozhat) {
  18.     vector<int> first(razmer_vectorov_kotorie_anya_budet_peremnozhat),
  19.                 second(razmer_vectorov_kotorie_anya_budet_peremnozhat);
  20.     for (auto& el : first) {
  21.         el = gen() % 10;
  22.     }
  23.     for (auto& el : second) {
  24.         el = gen() % 10;
  25.     }
  26.     high_resolution_clock::time_point t1 = high_resolution_clock::now();
  27.     // multiply(first, second);
  28.     high_resolution_clock::time_point t2 = high_resolution_clock::now();
  29.     duration<double> time_span = duration_cast<duration<double>>(t2 - t1);
  30.     std::cout << time_span.count() << '\n';
  31. }
  32.  
  33. int main()
  34. {
  35.     freopen("output.txt", "w", stdout);
  36.     for (int i = 100; i < 100000; i += 100)
  37.         test(i, gen);
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement