fork download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main(int argc, const char * argv[])
  7. {
  8. unsigned long long total = 0, ok = 0;
  9. for(;;)
  10. {
  11. int a[4] = { 0 };
  12. for(int i = 0; i < 5; ++i)
  13. a[rand()%4]++;
  14. total++;
  15. if (a[0] == 4 || a[1] == 4 || a[2] == 4 || a[3] == 4)
  16. ok++;
  17. if (total%1000000 == 0) cout << ok*100.0/total << endl;
  18. }
  19. }
  20.  
Time limit exceeded #stdin #stdout 5s 15232KB
stdin
Standard input is empty
stdout
5.8322
5.8503
5.84873
5.84258
5.84966
5.8478
5.85236
5.85766
5.85936
5.85706
5.85101
5.85515
5.85694
5.85821
5.86021
5.85997
5.86042
5.86206
5.86306
5.86204
5.86383
5.86235
5.8621
5.85943
5.85977
5.85947
5.86094
5.8606
5.86165
5.86149
5.86135
5.86056
5.8608
5.8598
5.8601
5.86019
5.86052
5.86027
5.86066
5.85959
5.86005
5.8595
5.85939
5.86083
5.86085
5.86148
5.86092
5.86065
5.86091
5.86098
5.86042
5.86083
5.86098
5.8613
5.86115
5.86054
5.86045
5.86086
5.86053
5.85996
5.85981
5.85983
5.85941
5.85893
5.85859
5.85911
5.85873
5.85815
5.85819
5.85822
5.85782
5.85777
5.85736
5.85716
5.85675
5.85694
5.85655
5.85668
5.85625
5.8565
5.85673
5.85698
5.85725
5.85728
5.85733
5.85741
5.85784
5.85754
5.85779
5.85769
5.85784
5.85793
5.85809
5.85799
5.85777
5.85781
5.85798
5.85792
5.85826
5.85848
5.8589
5.85888
5.85861
5.85872
5.85888
5.85882
5.85919
5.85894
5.85837
5.85843
5.85869
5.85857
5.85865
5.8588
5.85874
5.85841
5.85862
5.85882
5.8587
5.85906
5.85901
5.85902
5.85889
5.85885
5.85882
5.85888
5.85878