Search found 45 matches
- Sat Jun 21, 2003 2:25 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 182637
- Sat Jun 21, 2003 2:23 am
- Forum: Volume 1 (100-199)
- Topic: 147 - Dollars
- Replies: 233
- Views: 21149
I beg to differ
I don't really agree with either of you. You can do it without doubles at all, but then, that is a hassle in itself. Not using it would look like this: int intpart, input; char ch1, ch2; ins >> intpart; // Get integer part of the input ins >> ch1; // Decimal point, we can trash this ins >> ch1 >> ch...
- Thu Jun 19, 2003 7:09 am
- Forum: Volume 1 (100-199)
- Topic: 191 - Intersection
- Replies: 103
- Views: 18327
Two things you never do with floats and doubles: 1. Compare them directly. 2. Converting them directly to integers. You suffer from the first problem. NEVER compare floats directly. Due to rounding errors, you may have minute differences that make the internal representations different. Instead of a...
- Thu Jun 19, 2003 7:02 am
- Forum: General
- Topic: Never use yahoomail for submission
- Replies: 6
- Views: 1759
Not so!
I have used Yahoo! mail (two words, and make sure you include the exclamation) for some time to submit my solutions, though I've switched to the online submissions lately. First of all, disable HTML in preferences and send it as text. Don't complain that it doesn't send in text, because that's an op...
- Thu Jun 19, 2003 6:47 am
- Forum: Volume 1 (100-199)
- Topic: 147 - Dollars
- Replies: 233
- Views: 21149
Needless to say, these are errors
I actually had it happen on my Windows CodeWarrior compiler on this 147 problem (which is insanely easy, if you ask me) which is why I figured out I had to round on here. Really, try it explicitly with the following code, which will test for such rounding problems: [cpp]#include <iostream.h> #includ...
- Wed Jun 18, 2003 6:38 am
- Forum: Volume 1 (100-199)
- Topic: 147 - Dollars
- Replies: 233
- Views: 21149
That is how you always round!
If you don't round it like that, then it won't work whenever you use doubles. Second solution: use precision(0) on floats so it rounds to the nearest integer
- Thu May 01, 2003 7:17 am
- Forum: Volume 1 (100-199)
- Topic: 136 - Ugly Numbers
- Replies: 156
- Views: 18356
O(n^2)
Especially when a very simple O(n^2) algorithm exists, as well as some more complex ones that run faster. But we're taking sub .1 second times here.
- Fri Apr 25, 2003 2:45 am
- Forum: Volume 1 (100-199)
- Topic: 157 - Route Finding
- Replies: 17
- Views: 2645
Test Case
Here is a test case:
5
A:ab=Bbcdefghijk
B:abc=Ajdef=Cb
C:ab
D:cd=Eg
E:fg=Bf
AaAk
AcAk
AbBb
BaDd
#
The correct output is:
9: Aab=Bbc=Ajk
8: Acdefghijk
3: Ab=Bb
8: Babcdef=Dd
Your program gives:
9: Aab=Bbc=Ajk
8: Acdefghijk
3: Ab=Bb
11: Babcdef=Eg=Dd
5
A:ab=Bbcdefghijk
B:abc=Ajdef=Cb
C:ab
D:cd=Eg
E:fg=Bf
AaAk
AcAk
AbBb
BaDd
#
The correct output is:
9: Aab=Bbc=Ajk
8: Acdefghijk
3: Ab=Bb
8: Babcdef=Dd
Your program gives:
9: Aab=Bbc=Ajk
8: Acdefghijk
3: Ab=Bb
11: Babcdef=Eg=Dd
- Wed Apr 23, 2003 4:14 am
- Forum: Volume 1 (100-199)
- Topic: 199 - Partial differential equations
- Replies: 15
- Views: 4382
199 - Partial differential equations
I have been trying to solve problem 199 (Partial Differential Equations), and have noticed two things: 1. The sample output as stated in the problem description is wrong. It should be: -36 0 0 36 0 -36 27 0 0 18 -36 0 9 0 0 -36 -35 -188 -189 -315 2. I get a Presentation Error for no good reason, eve...
- Tue Apr 22, 2003 8:47 am
- Forum: Volume 1 (100-199)
- Topic: 139 - Telephone Tangles
- Replies: 66
- Views: 8274
Presentation Error 139
I am getting a Presentation Error for 139. I have tried many formatting devices, tabs, spaces, getting rid of trailing spaces, etc., and I keep getting Presentation Errors! I do not see any formatting information in the text, but some of the submissions have been accepted without Presentation Error,...
- Sun Apr 21, 2002 10:34 pm
- Forum: Volume 1 (100-199)
- Topic: 110 - Meta-Loopless Sorts
- Replies: 92
- Views: 7776
- Sun Apr 21, 2002 10:26 pm
- Forum: Volume 1 (100-199)
- Topic: 110 - Meta-Loopless Sorts
- Replies: 92
- Views: 7776
Problem 110 HAS to be wrong
I am hereby convinced that... the judge for problem 110 doesn't work. It's just amazing how many things I've tried on it, even sample solutions from other websites, and guess what, they don't work. Also, the problem description for 199 needs to be corrected. Sample b vector is -35 -188 -189 -315. An...
- Sun Apr 21, 2002 10:17 pm
- Forum: Volume 1 (100-199)
- Topic: 110 - Meta-Loopless Sorts
- Replies: 92
- Views: 7776
See, I have this:
// @BEGIN_OF_SOURCE_CODE /* @JUDGE_ID: 17243NT 110 C++ "<img src='http://http://acm.uva.es/problemset/flags/us.gif'>" */ // Send to judge@uva.es #include <fstream.h> #include <iomanip.h> #include <string.h> #include <iostream.h> #ifdef ONLINE_JUDGE #define ins cin #define outs cout #else #define in...
- Fri Apr 19, 2002 3:45 am
- Forum: Volume 1 (100-199)
- Topic: 110 - Meta-Loopless Sorts
- Replies: 92
- Views: 7776
110 - Meta-Loopless Sorts
See, I have solved this, found it doesn't work (though it looks fine to me), found two other solutions floating around on the web which produce the same answer, and big surprise, they don't work. Can anybody tell me if this program generates the right cases for up to n equals 8? [cpp] #include <iost...
- Fri Apr 19, 2002 3:30 am
- Forum: Volume 1 (100-199)
- Topic: 143 - Orchard Trees
- Replies: 90
- Views: 12581