- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblility.cpp
More file actions
Latest commit
25 lines (25 loc) · 432 Bytes
/
Copy pathProblility.cpp
File metadata and controls
25 lines (25 loc) · 432 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<iostream>
#include<vector>
#include<iterator>
#include<ctime>
#include<cstdlib>
usingnamespacestd;
using std::iterator;
vector<int> &Construct(int n,int m)
{
vector<int> get;
srand((unsigned) time(NULL));
for(int i=0;i<n;i++)
{
if(rand()%(n-i)<=m&&m>=1)
{
get.push_back(i);
m--;
}
}
}
intmain()
{
vector<int> get = Construct(10,5);
copy(get.begin(),get.end(),ostream_iterator<int,char>(cout,""));
}