|
|
back to boardUnable to understand the sample test case If somebody can explain the sample test case, in my opinion average should be (0.5 +0.5+0.5)/3 which is 0.5 Re: Unable to understand the sample test case it is easy double a = 0; Random r = new Random(); int nit = 1000000; for(int it=0;it<nit;++it){ double ax = 0, ay = 0; double bx = r.nextDouble(), by = r.nextDouble(); double cx = r.nextDouble(), cy = r.nextDouble(); a+=Math.abs(bx*cy-cx*by)/2; } out.println(a/nit); |
|
|