fork download
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <ctime>
  4. typedef unsigned long long int type;
  5. using namespace std;
  6. const type MAX = 100;
  7.  
  8. int main()
  9. {
  10. srand(time(NULL));
  11. type *T = new type [MAX] {};
  12. const type R = 10000000;
  13. for(type i = 0; i < R; ++i)
  14. ++T[rand()%MAX];
  15.  
  16. for(type i = 0; i < MAX; ++i)
  17. cout<<i<<": "<<T[i]<<endl;
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.5s 3472KB
stdin
Standard input is empty
stdout
0: 100132
1: 100373
2: 100350
3: 100413
4: 100034
5: 100112
6: 99764
7: 99532
8: 99825
9: 99694
10: 99630
11: 100026
12: 99496
13: 100862
14: 99704
15: 99855
16: 99912
17: 100225
18: 100194
19: 99855
20: 100100
21: 99728
22: 99900
23: 100070
24: 100440
25: 100110
26: 100056
27: 100159
28: 100647
29: 99827
30: 100390
31: 100242
32: 100094
33: 100322
34: 100114
35: 99967
36: 100487
37: 99811
38: 100184
39: 99853
40: 100634
41: 100152
42: 99839
43: 99838
44: 99851
45: 100063
46: 99866
47: 99876
48: 99795
49: 99540
50: 100014
51: 99506
52: 99254
53: 99324
54: 100211
55: 99827
56: 100148
57: 99847
58: 99549
59: 99795
60: 100407
61: 100055
62: 100207
63: 99715
64: 100055
65: 99790
66: 100072
67: 100343
68: 100254
69: 99899
70: 99917
71: 100229
72: 99545
73: 99683
74: 100419
75: 100423
76: 99617
77: 100320
78: 99591
79: 99647
80: 99640
81: 100111
82: 100128
83: 99960
84: 100252
85: 100321
86: 100534
87: 99685
88: 100321
89: 99970
90: 99812
91: 99790
92: 100848
93: 99263
94: 100110
95: 99870
96: 99602
97: 100148
98: 99853
99: 100176