fork download
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. #define N 207
  5. int rnd5(){ return (rand()%5) + 1; }
  6. int rndN(){
  7. int a, i;
  8. a = 0;
  9. for(i = 0; i < 5 * N; i++)
  10. a += rnd5();
  11. return a % N + 1;
  12. }
  13.  
  14. int main() {
  15. static int l[N + 1];
  16. int i;
  17. for(i=0;i<100000;i++)
  18. l[rndN()]++;
  19.  
  20. for(i=1;i<=N;i++)
  21. printf("%d:%d\n", i, l[i]);
  22. return 0;
  23. }
  24. /* end */
  25.  
Success #stdin #stdout 2.93s 1676KB
stdin
Standard input is empty
stdout
1:842
2:916
3:921
4:882
5:850
6:822
7:832
8:886
9:881
10:867
11:857
12:893
13:834
14:810
15:868
16:856
17:773
18:860
19:848
20:814
21:770
22:742
23:798
24:746
25:793
26:752
27:759
28:742
29:724
30:690
31:686
32:687
33:688
34:679
35:641
36:675
37:608
38:634
39:659
40:593
41:587
42:621
43:586
44:560
45:540
46:506
47:503
48:508
49:518
50:447
51:496
52:452
53:475
54:447
55:444
56:430
57:433
58:387
59:409
60:413
61:366
62:385
63:363
64:319
65:333
66:327
67:295
68:321
69:282
70:297
71:299
72:296
73:272
74:251
75:237
76:234
77:265
78:228
79:224
80:189
81:207
82:220
83:187
84:181
85:192
86:206
87:193
88:179
89:180
90:157
91:169
92:149
93:153
94:170
95:153
96:125
97:129
98:135
99:128
100:144
101:141
102:133
103:121
104:128
105:147
106:123
107:134
108:134
109:114
110:126
111:134
112:129
113:140
114:142
115:156
116:148
117:168
118:154
119:143
120:155
121:157
122:164
123:201
124:185
125:167
126:206
127:180
128:195
129:224
130:235
131:207
132:203
133:226
134:245
135:254
136:262
137:276
138:290
139:293
140:287
141:311
142:312
143:335
144:328
145:366
146:390
147:343
148:369
149:395
150:348
151:370
152:411
153:417
154:426
155:459
156:414
157:461
158:522
159:477
160:463
161:532
162:517
163:510
164:536
165:605
166:551
167:582
168:597
169:613
170:618
171:620
172:653
173:628
174:676
175:649
176:636
177:723
178:755
179:705
180:707
181:722
182:741
183:741
184:773
185:787
186:795
187:803
188:792
189:845
190:774
191:856
192:818
193:842
194:777
195:840
196:841
197:810
198:906
199:879
200:871
201:838
202:837
203:943
204:911
205:860
206:856
207:905