Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <vector>
- #include <Windows.h>
- #include <list>
- #define storgeType vector
- using namespace std;
- int main()
- {
- LARGE_INTEGER freq;
- LARGE_INTEGER end;
- LARGE_INTEGER start;
- int n;
- cout << "Input number of elements: ";
- cin >> n;
- cout << endl;
- ::QueryPerformanceFrequency( &freq );
- ::QueryPerformanceCounter( &start );
- storgeType< storgeType< int > > res;
- storgeType< int > v;
- for( int i = 0; i < n; i++ )
- v.push_back( i );
- do
- {
- res.push_back( v );
- } while ( next_permutation ( v.begin() ,v.end() ) );
- ::QueryPerformanceCounter( &end );
- long m_llCurrentTimeInMs = (long) ((end.QuadPart - start.QuadPart) * 1000.0 / (double) freq.QuadPart);
- cout << "Finished!" << endl;
- cout << m_llCurrentTimeInMs << endl;
- cin >> n;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement