ENG
RUS
Timus 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
Discussion of Problem
1973
. Location Generator
Show all threads
Hide all threads
Show all messages
Hide all messages
Unable to understand the sample test case
gautamvs
1973
. Location Generator
2 Mar 2014 00:11
2
Unable to understand the sample test case
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
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);
New topic
Style:
flat
|
tree
|
nested
Thread Order:
bubble
|
fixed
© 2000–2024
Timus Online Judge Team
. All rights reserved.