Search found 454 matches

Mon Mar 21, 2005 9:17 pm
Forum: Volume 108 (10800-10899)
Topic: 10830 - A New Function
Replies: 33
Views: 15368
Eduard wrote: Can this formula calculated faster?
My previous post is talking about that.
Mon Mar 21, 2005 8:34 pm
Forum: Volume 108 (10800-10899)
Topic: 10830 - A New Function
Replies: 33
Views: 15368
I don't know what formulas your have now so I just talk about my logic. Although the detail may be different from each person, but the logic should be similar: To find CSOD you can sum some function O(1) f(x, N) from 1 to N, that is, CSOD(N) = f(1,N)+f(2,N)+...+f(N,N) In my code, the values f(x,N) w...
Mon Mar 21, 2005 8:22 pm
Forum: Volume 2 (200-299)
Topic: 204 - Robot Crash
Replies: 26
Views: 5549
My code makes this output: Robot Problem #1: Robots collide at (3.33,4.33) I have checked my code, for each collision, I take the later time of arrival as the time of collision, so for 0.4714 vs. 0.3727 I takes 0.4714. Don't ask me why I do that, I forget the detail already and it seems that I just ...
Mon Mar 21, 2005 6:12 am
Forum: Other words
Topic: how do I fix "Compile Error" ?
Replies: 2
Views: 850
In your personal informatin page, set it to receive a email after submission,
then you will get the error message during compliation.
Sun Mar 13, 2005 1:41 pm
Forum: Off topic (General chit-chat)
Topic: A request to University of Waterloo
Replies: 19
Views: 5479
I think giving solution can let begineer to learn. Most of the Waterloo solution are written in very good way. People can learn through reading these code.

If someone uses these code to cheat, they are losing the chance to learn. I don't mind.
Sun Mar 13, 2005 12:06 pm
Forum: Volume 3 (300-399)
Topic: 357 - Let Me Count The Ways
Replies: 90
Views: 7175
Yes, you can insist using your coding mathod, that's not my business.
But one day you will pay for using bad coding method in other problem.
Sun Mar 13, 2005 11:39 am
Forum: Volume 3 (300-399)
Topic: 357 - Let Me Count The Ways
Replies: 90
Views: 7175
I give you 2 comments:

1. %0.0f is not a correct format, although it does what you want in this question. Check the document to see the meaning of that bolded zero %0.0f .

2. Don't use floating point if it is not necessary, so easy to fall in precision error.
Sat Mar 12, 2005 3:24 pm
Forum: Volume 107 (10700-10799)
Topic: 10784 - Diagonal
Replies: 27
Views: 14093
The mistake is obvious......
Run the sample input again........
Sat Mar 12, 2005 3:18 pm
Forum: Volume 107 (10700-10799)
Topic: 10784 - Diagonal
Replies: 27
Views: 14093
If the line of AC code can't give you AC, then you must have some other problems.

P.S. It seems that I don't remember the detail correctly, the second method in my last post is wrong.
Sat Mar 12, 2005 3:05 pm
Forum: Volume 107 (10700-10799)
Topic: 10784 - Diagonal
Replies: 27
Views: 14093
This is what I used in my AC code:

Code: Select all

`````` printf ("Case %d: %d\n", t++,          (int)ceil((3.0+sqrt(9.0+8.0*N))/2.0-1e-10));
``````
Sat Mar 12, 2005 2:42 pm
Forum: Volume 107 (10700-10799)
Topic: 10784 - Diagonal
Replies: 27
Views: 14093
Sorry typo, should be 1e-10.
fmod() sucks, I never use it. And I already say using ceil or floor is enough.

The problem of your code is
printf(".0lf", m+0.5);
People think it will work perfectly in rounding, but it doesn't.
Sat Mar 12, 2005 1:53 pm
Forum: Volume 107 (10700-10799)
Topic: 10784 - Diagonal
Replies: 27
Views: 14093
Precision error. I used +0.5 as theshold when I need to round a "normal" floating point number(say, 3.4, 1.2, etc.) to integer. If a floating point number is storing a number, which should be an integer in theory, I will use much smaller theshold like +1e-10. You will get AC by trying different comb...
Sat Mar 12, 2005 10:09 am
Forum: Volume 102 (10200-10299)
Topic: 10207 - The Unreal Tournament
Replies: 23
Views: 6282
For invalid input, output this

-1.00000
0

The range of i, j are given clearly, and you require BigInt to solve this problem. This problem is not that trivial, beside finding the maths. logic behind, you have to fight with time limit and memory limit too.
Fri Mar 11, 2005 1:39 pm
Forum: Volume 108 (10800-10899)
Topic: 10826 - Hot or Cold?
Replies: 26
Views: 13126
Well.... I would guess they are sending a table....Just 300 numbers
Thu Mar 10, 2005 7:32 pm
Forum: C
Topic: Whats wrong with this basic C code...
Replies: 2
Views: 1867
Precision error. In if (a<0.7) [\code] The "0.7" is in double type, when you compare it with "a" (a float type "0.7"), "a" is first changed to double, and this lead precision error. Try the following program then you will know that [code] #include<stdio.h> void main() { float a=0.7; double b=0.7; pr...