ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1973. Location Generator

Unable to understand the sample test case
Posted by gautamvs 11 Oct 2013 11:58
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
Posted by Vit Demidenko 2 Mar 2014 00:11
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);