|
|
You can just brute force all possible points on the grid. For every point check whether that point is under attack. So, your grid is just a SZ*SZ square matrix. SZ=200 is accurate enough, and even somewhat smaller values are OK. What about Simpson integration ? please. In my programme, I use 1000 000 random locations to check if the points are in the circle. At first, I wrote something like this: "double tx = ( double )( rand() % 101 ) / 100.0 ";(because: 0 ≤ x ≤ 1, -> rand() % 101 ∈[ 0, 100 ] );and just got WA...... Finally I changed the 101 into 100 and got AC; Can anyone tell me why 101 is incorrect? or it is actually right? You're just lucky that in the second case you got AC - actually good tests will kill your second solution as well, because what you generate is random point on integer grid 100 x 100 and this is far from random real point. Good way of generating random point in unit square is doing double(rand()) / RAND_MAX for both coordinates - this will give you point close enough to truly random. Thanks for your reply, I realize I have mixed up continuity and dispersion. :-) Can it be solved with monte carlo alogrithm? I used 10^6 points for checking and got WA at test #10. Then changed number of points to 10^5 and still get WA#10. Edited by author 19.10.2004 02:09 I cut the square into 10^5 stripes and WA #10. Then I magnified the picture by 10^4 times and changed real into extended, WA #10 still. Wrong test, or wrong algo? I used 10^6 points checking and I got AC=) Try to post your code I'm sure the problem there I've solved it with monte carlo alogrithm. So, i can say that it is possible please, tell me how to solve this problem. I can't find right solution to this problem. 2 0.2 0.2 0.5 0.8 0.8 0.5 My accepted program returns 81, but the answer from statement is 80... "Precision of the result is required to be 1% or better." So answer 81 is OK. Oh, OK! It's my permanent problem - don't reaв the statement. I'm using pure Monte-Carlo method. Here is my code (C#): [Code deleted by author] I've found my bug... P.S. For the pure Monte-Carlo method it is enough 10^5 points and Double type. Edited by author 13.06.2010 19:25 100 * 100 pts are enough. Sorry, I have AC! Edited by author 18.05.2007 17:10 Edited by author 18.05.2007 17:11 [code deleted] Edited by author 28.01.2007 02:44 It was really hard to understand your prog for me:) (use pascal:) try this test 0 Thank's a lot!!! I've got AC!!! But how I can to optimize my program? (My time 0.213) :) Now I've got AC in 0.015 :) Thank's for help!!! subj =) - 779321 15:38:34 7 мар 2005 ronobe (aka oberon) 1333 C++ Accepted 0.015 107 КБ The time and exectness can be changed by one constant. In first AC submission it was 100000. In three next submissions this constant was lowered to 10000, 1000, 100 and I got AC too in 0.015... that's boring. AC - is most wanted. Not in this problem... Edited by author 05.10.2006 21:29 Edited by author 05.10.2006 21:29 С какой точностью выводить? One persent as written ;D Could anybody tell me the detail? Yeah,but how to present a circle? My program: count = 0; for X from 0.000 to 1.000 for Y from 0.000 to 1.000 if Point(X,Y) within some cirle then count := count+1 write(count/1000000*100); Simplest solution: O(1000^2) works 0.39 seconds. Why your name is Hybrid Theory? It's one of Linkin Park's albums(2000) Do you like Linkin Park? If you like it, then write me: \\tair_a@mail.ru \\fred007@mail.ru Why we now have 10 tries instead of 5 as was before rejudging? It contains only one digit - and this digit is 0, so n=0, so what should I output? I've tryed '0', '0.25' ,..., '2', '3', '4', '5', '6', '10', '99', '100', 'No solution', 'No', 'no', '0%', '0.00', '-1'... Nothing helps. What's wrong? Why do you think that test number 4 contains only zero (0)? Edited by author 16.10.2004 16:20 <font color=#FF0000> ASD </font> |
|
|