|
|
I always AC with long code, I want to short my code, anyone has ideas with short code? The statement "in the case of tie, you also have to minimize the number of rolls" is ambiguous. There might be a situation when using more rolls we can win (for instance) 1E-8 of distance. I had problems in understanding what should I do in such case and finally fell to EPS=1E-4 while updating the result. Is it correct or the tests are just weak? P.S. I am learning C++, and I had a problem with pi. We have M_PI in BCC and VCC, but not in ICL. I had to declare "const double PI = 3.14159265358979323846" (extracted from math.h of VCC). Does anybody know what constant for pi is used in ICL? Edited by author 26.04.2006 22:56 I use const double PI = 3.1415... const double Pi = acos(-1.0); #define USE_MATH_DEFS #define _USE_MATH_DEFINES #include <math.h> const double PI = M_PI; I got Ac using convertion: __int64 RRec=10000*(double)Rec; if (RRec%10>4) RRec=RRec-RRec%10+10; else RRec=RREc-RRec%10; and Rec=RREc; Rec=Rec/10000; But I am not sure that it so important Why so many pepole have troubles with this problem?? Dull brute force with "exit if we are too far from target" gets AC in 0.031 sec... I think, it is one of most complicated problems in the archive. Several different ideas make search fast enough, but I never might have guessed it without tests below. So, thank you, DWED! My program ran fast, even with little optimization.. But wrong answer on 7.. up till now, i haven't found any bugs from it.. Could you leave some hints for me?:( thanx. See e-mail in my profile. It is very tiresome to hold such conversation in English. I don't think my algorithm is wrong.. but wa on 7:( maybe precision error?!?..:( I will be very appreciated if someone could make me the first ACer:) Input1: 10.0 10.0 1000.0 0.0 5 Output1: 972.679 5 0 2 1 4 3 0 Input2: 1 1 20.05 0.0 16 Output2: 10.967 16 0 2 1 4 0 3 2 1 0 3 4 1 0 3 2 1 0 Input3: 1 1 100.00 0.0 32 Output3: 81.397 32 0 2 1 4 0 3 2 1 0 3 4 1 0 3 2 1 0 3 4 1 0 3 2 1 0 3 4 1 0 3 2 1 0 Input4: 1 1 20.05 0.0 32 Output4: 1.863 32 0 2 1 4 0 3 2 1 0 3 4 1 0 3 2 1 0 3 4 1 0 3 2 1 0 3 4 1 0 3 2 1 0 Input5: 1 1.9 20.05 0.0 32 Output5: 0.085 32 0 2 1 4 3 2 1 0 3 4 1 2 0 1 2 3 4 0 3 4 1 2 0 1 2 3 4 1 0 3 2 1 0 Why the output5 is incorrect? Edited by author 08.10.2005 18:40 For Dean's pyramid problem, we have: "If after the turn over some edge the pyramid stands on its base, the next turn can be performed either over the same edge or over the opposite edge of the pyramids base only." how about this problem? (i haven't seen any words describing such prop.. 0.085 32 0 2 1 4 3 2 1 0 3 4 1 2 0 3 4 1 2 0 3 4 1 2 0 3 4 1 2 3 0 1 4 3 0 maybe ours are the same. i haven't checked. i got wa on 7 :S...i donnot why.. Edited by author 21.10.2005 22:00 Don't you know why this problem havn't been solved yet? I know! The second test consists of 3 char, that exaxtly are: "1 " |
|
|