Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <ctime>
- using namespace std;
- typedef long long ll;
- int main(){
- srand(time(0));
- ll n=1;
- ll count=0;
- ll poscount=0;
- for (ll t=0; t<20; t++){
- n*=10;
- for (ll i=0; i<n; i++)
- {
- set<ll> sett {0,1,2,3,4,5,6};
- bool au[7] {};
- bool b=false;
- if ((rand() % 10)>2)
- au[rand()%7]=true;
- ll h=rand()%7;
- sett.erase(h);
- for(auto&k:sett){
- if (au[k]){
- b=true;
- break;
- }
- }
- if (!b)
- if (au[h]){
- poscount++;
- count++;
- }
- else
- count++;
- }
- //cout << poscount << ' ' << count;
- cout << (double)poscount*1.0/count << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement