Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. // lab6.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3.  
  4. #include "pch.h"
  5. #include <iostream>
  6. #include <vector>
  7. #include <random>
  8. #include <algorithm>
  9. #include <iterator>
  10. #include <numeric>
  11. #include <chrono>
  12.  
  13. int main()
  14. {
  15. std::default_random_engine gen(0);
  16. std::binomial_distribution<int> dist(100, 0.1);
  17. std::chrono::high_resolution_clock timer;
  18. for (int i = 1; i < 13; i++)
  19. {
  20. auto start = timer.now();
  21. int N = i;
  22. std::vector<int> per(N);
  23. std::iota(per.begin(), per.end(), 0);
  24. int ilosc = 0;
  25. //std::ostream_iterator<float> out_it(std::cout, ", ");
  26. do {
  27. //std::copy(per.begin(), per.end(), out_it);
  28. ilosc++;
  29. } while (std::next_permutation(per.begin(), per.end()));
  30. auto end = timer.now();
  31. auto nsecs = std::chrono::duration_cast<std::chrono::milliseconds> (end - start).count();
  32. std::cout << "N = " << N << " Czas: " << nsecs << "ms \n";
  33. }
  34.  
  35.  
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement