fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. /* Name of the class has to be "Main" only if the class is public. */
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. int k = 0;
  11. Scanner in = new Scanner(System.in);
  12. double[] x = new double[200];
  13. double[] p = new double[101];
  14. for (int i = 0; i < 200; i++){
  15. x[i] = in.nextDouble();
  16. k = (int)(x[i]*100.0 + 0.5);
  17. p[k] += 1;
  18. }
  19. for (int i = 1; i < 101; i++){
  20. System.out.println("p[" +i + "] = " + p[i]/2000.0);
  21. }
  22.  
  23. }
  24. }
Success #stdin #stdout 0.2s 34004KB
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.02
stdout
p[1] = 0.0665
p[2] = 0.0135
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] = 5.0E-4
p[10] = 5.0E-4
p[11] = 5.0E-4
p[12] = 0.0
p[13] = 5.0E-4
p[14] = 5.0E-4
p[15] = 0.0
p[16] = 0.0
p[17] = 5.0E-4
p[18] = 0.0
p[19] = 0.0
p[20] = 5.0E-4
p[21] = 0.0
p[22] = 0.0
p[23] = 0.0
p[24] = 0.0
p[25] = 5.0E-4
p[26] = 0.0
p[27] = 0.0
p[28] = 0.0
p[29] = 0.0
p[30] = 0.0
p[31] = 0.0
p[32] = 0.0
p[33] = 5.0E-4
p[34] = 0.0
p[35] = 0.0
p[36] = 0.0
p[37] = 0.0
p[38] = 0.0
p[39] = 0.0
p[40] = 0.0
p[41] = 0.0
p[42] = 0.0
p[43] = 0.0
p[44] = 0.0
p[45] = 0.0
p[46] = 0.0
p[47] = 0.0
p[48] = 0.0
p[49] = 0.0
p[50] = 5.0E-4
p[51] = 0.0
p[52] = 0.0
p[53] = 0.0
p[54] = 0.0
p[55] = 0.0
p[56] = 0.0
p[57] = 0.0
p[58] = 0.0
p[59] = 0.0
p[60] = 0.0
p[61] = 0.0
p[62] = 0.0
p[63] = 0.0
p[64] = 0.0
p[65] = 0.0
p[66] = 0.0
p[67] = 0.0
p[68] = 0.0
p[69] = 0.0
p[70] = 0.0
p[71] = 0.0
p[72] = 0.0
p[73] = 0.0
p[74] = 0.0
p[75] = 0.0
p[76] = 0.0
p[77] = 0.0
p[78] = 0.0
p[79] = 0.0
p[80] = 0.0
p[81] = 0.0
p[82] = 0.0
p[83] = 0.0
p[84] = 0.0
p[85] = 0.0
p[86] = 0.0
p[87] = 0.0
p[88] = 0.0
p[89] = 0.0
p[90] = 0.0
p[91] = 0.0
p[92] = 0.0
p[93] = 0.0
p[94] = 0.0
p[95] = 0.0
p[96] = 0.0
p[97] = 0.0
p[98] = 0.0
p[99] = 0.0
p[100] = 5.0E-4