Most of the time, I agree. Once in a while I find a problem is complex enough that it's worth using classes just to help organize your thoughts. Not often, but once in a while.
I've joked with friends that you can tell how hard I consider a problem by seeing how long my variable names are and how ...
Search found 16 matches
*nod* the trust's a problem. Anyway, why would you want to catch up with my C++ thing? After all, if your language doesn't include it, clearly you don't really need it . . . ;)
But in any case, I'd just be wanting basic arithmetic and display functions, nothing special. Not like a SolveLinearSystem ...
But in any case, I'd just be wanting basic arithmetic and display functions, nothing special. Not like a SolveLinearSystem ...
I don't think it makes sense to artificially fight against it ("Oh, and this problem has different constraints if you're using X language") and it seems pretty dumb to restrict the "more powerful" languages, but it also seems that if this is an algorithm contest and not a who-has-the-best-canned ...
- Thu Nov 28, 2002 2:59 am
- Forum: Algorithms
- Topic: Probability problem
- Replies: 0
- Views: 2032
Personally, I'd just brute-force it with some DP. You can index it based on the number of unique colors (keeping in mind that you can never have two of any color, and that colors are essentially interchangable, it's easy to see that there are C+1 possible states to exist in at any step). One million ...
- Wed Nov 06, 2002 9:17 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 318271
- Wed Nov 06, 2002 6:41 am
- Forum: Volume 1 (100-199)
- Topic: 105 - The Skyline Problem
- Replies: 160
- Views: 51459
For submission, the code you've got there will work beautifully - it'll hit end-of-stream and go into More Stuff.
For testing purposes, I recommend coming up with a sentinel value to indicate "end of stream" - if( n == -2 ) break; - and then write -2 to end it. Just remember to pull it out before ...
For testing purposes, I recommend coming up with a sentinel value to indicate "end of stream" - if( n == -2 ) break; - and then write -2 to end it. Just remember to pull it out before ...
- Wed Nov 06, 2002 12:03 am
- Forum: C++
- Topic: ANSI C++ Manual
- Replies: 5
- Views: 3909
- Tue Nov 05, 2002 11:55 pm
- Forum: Algorithms
- Topic: Longest path
- Replies: 5
- Views: 5213
- Tue Nov 05, 2002 8:55 am
- Forum: Algorithms
- Topic: Generating Combinations
- Replies: 5
- Views: 4478
Not really any point IMHO - since the input is integers [0,n), the straight array will be more efficient. If you want to use something dynamically sized to keep from out-of-boundsness (which is a really good idea *grin*), I recommend vector< bool >. Performance *probably* wouldn't be a problem with ...
- Tue Nov 05, 2002 6:50 am
- Forum: C++
- Topic: C++ Skeleton
- Replies: 7
- Views: 4606
C++ has no equivalents to gotoxy() or clrscr(). In fact, C doesn't either, technically, those functions are compiler-specific.
Now, as for compiler-specific, if you're on Linux check out the ncurses library. If you're going for Win32, start with looking up AllocConsole(). If you're on anything else ...
Now, as for compiler-specific, if you're on Linux check out the ncurses library. If you're going for Win32, start with looking up AllocConsole(). If you're on anything else ...