fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int k = 0;
  6. double p[101] = {0};
  7. double x[200];
  8. for (int i = 0; i < 200; i++){
  9. cin >> x[i];
  10. k = (int)(x[i]*100.0 + 0.5);
  11. p[k]+=1;
  12. }
  13. for (int i = 1; i < 101; i++){
  14. cout << "p[" << i << "]=" << p[i]/2000.0 << " ";
  15. if (i%10 == 0) cout << "\n";
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0s 4336KB
stdin
1 0.5 0.333333 0.25 0.2 0.166667 0.142857 0.125 0.111111 0.1 0.0909091 0.0833333 0.0769231 0.0714286 0.0666667 0.0625 0.0588235 0.0555556 0.0526316 0.05 0.047619 0.0454545 0.0434783 0.0416667 0.04 0.0384615 0.037037 0.0357143 0.0344828 0.0333333 0.0322581 0.03125 0.030303 0.0294118 0.0285714 0.0277778 0.027027 0.0263158 0.025641 0.025 0.0243902 0.0238095 0.0232558 0.0227273 0.0222222 0.0217391 0.0212766 0.0208333 0.0204082 0.02 0.0196078 0.0192308 0.0188679 0.0185185 0.0181818 0.0178571 0.0175439 0.0172414 0.0169492 0.0166667 0.0163934 0.016129 0.015873 0.015625 0.0153846 0.0151515 0.0149254 0.0147059 0.0144928 0.0142857 0.0140845 0.0138889 0.0136986 0.0135135 0.0133333 0.0131579 0.012987 0.0128205 0.0126582 0.0125 0.0123457 0.0121951 0.0120482 0.0119048 0.0117647 0.0116279 0.0114943 0.0113636 0.011236 0.0111111 0.010989 0.0108696 0.0107527 0.0106383 0.0105263 0.0104167 0.0103093 0.0102041 0.010101 0.01 0.00990099 0.00980392 0.00970874 0.00961538 0.00952381 0.00943396 0.00934579 0.00925926 0.00917431 0.00909091 0.00900901 0.00892857 0.00884956 0.00877193 0.00869565 0.00862069 0.00854701 0.00847458 0.00840336 0.00833333 0.00826446 0.00819672 0.00813008 0.00806452 0.008 0.00793651 0.00787402 0.0078125 0.00775194 0.00769231 0.00763359 0.00757576 0.0075188 0.00746269 0.00740741 0.00735294 0.00729927 0.00724638 0.00719424 0.00714286 0.0070922 0.00704225 0.00699301 0.00694444 0.00689655 0.00684932 0.00680272 0.00675676 0.00671141 0.00666667 0.00662252 0.00657895 0.00653595 0.00649351 0.00645161 0.00641026 0.00636943 0.00632911 0.00628931 0.00625 0.00621118 0.00617284 0.00613497 0.00609756 0.00606061 0.0060241 0.00598802 0.00595238 0.00591716 0.00588235 0.00584795 0.00581395 0.00578035 0.00574713 0.00571429 0.00568182 0.00564972 0.00561798 0.00558659 0.00555556 0.00552486 0.00549451 0.00546448 0.00543478 0.00540541 0.00537634 0.00534759 0.00531915 0.00529101 0.00526316 0.0052356 0.00520833 0.00518135 0.00515464 0.00512821 0.00510204 0.00507614 0.00505051 0.00502513 0.005 
stdout
p[1]=0.067 p[2]=0.013 p[3]=0.006 p[4]=0.003 p[5]=0.002 p[6]=0.0015 p[7]=0.001 p[8]=0.001 p[9]=0.0005 p[10]=0.0005 
p[11]=0.0005 p[12]=0 p[13]=0.0005 p[14]=0.0005 p[15]=0 p[16]=0 p[17]=0.0005 p[18]=0 p[19]=0 p[20]=0.0005 
p[21]=0 p[22]=0 p[23]=0 p[24]=0 p[25]=0.0005 p[26]=0 p[27]=0 p[28]=0 p[29]=0 p[30]=0 
p[31]=0 p[32]=0 p[33]=0.0005 p[34]=0 p[35]=0 p[36]=0 p[37]=0 p[38]=0 p[39]=0 p[40]=0 
p[41]=0 p[42]=0 p[43]=0 p[44]=0 p[45]=0 p[46]=0 p[47]=0 p[48]=0 p[49]=0 p[50]=0.0005 
p[51]=0 p[52]=0 p[53]=0 p[54]=0 p[55]=0 p[56]=0 p[57]=0 p[58]=0 p[59]=0 p[60]=0 
p[61]=0 p[62]=0 p[63]=0 p[64]=0 p[65]=0 p[66]=0 p[67]=0 p[68]=0 p[69]=0 p[70]=0 
p[71]=0 p[72]=0 p[73]=0 p[74]=0 p[75]=0 p[76]=0 p[77]=0 p[78]=0 p[79]=0 p[80]=0 
p[81]=0 p[82]=0 p[83]=0 p[84]=0 p[85]=0 p[86]=0 p[87]=0 p[88]=0 p[89]=0 p[90]=0 
p[91]=0 p[92]=0 p[93]=0 p[94]=0 p[95]=0 p[96]=0 p[97]=0 p[98]=0 p[99]=0 p[100]=0.0005