Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*#include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- set<ll> simpl(ll s){
- set<ll> lll;
- for (ll i=2; i<s; i++){
- if (s%i==0){
- lll.insert(i);
- }
- }
- return lll;
- }
- int main(){
- for (ll n=0; n<10000; n++) {
- cout << n << ':';
- for (auto& j:simpl(n*n*n*n+n*n+1))
- cout << j << ',';
- cout << endl;
- }
- return 0;
- }*/
- /*#include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- int main(){
- double s1=1774, s2=1899;
- for (int i=3; i<2108; i++)
- {
- double s3;
- s3=(double)((double)s2+1.0)/s1;
- cout << i << " : " << s3 << endl;
- s1=s2;
- s2=s3;
- }
- return 0;
- }*/
- #include <bits/stdc++.h>
- #include <ctime>
- using namespace std;
- typedef long long ll;
- int main(){
- ll count=0;
- ll poscount=0;
- srand(time(0));
- for (int i=3; i<100000; 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;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement