Search found 16 matches

by zorbathut
Tue Dec 10, 2002 4:03 am
Forum: C++
Topic: Bigint
Replies: 37
Views: 17172

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 ma...
by zorbathut
Sun Dec 01, 2002 3:52 pm
Forum: C++
Topic: Bigint
Replies: 37
Views: 17172

*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 ...
by zorbathut
Sat Nov 30, 2002 11:57 pm
Forum: C++
Topic: Bigint
Replies: 37
Views: 17172

1) People who use the language and want to add them :P I don't know how this site's system is set up in detail, but it really shouldn't be all that hard to add the headers and link the library in by default. I'd do it, but I doubt they'd let me, I'm not exactly a world-famous trusted competitor ;) A...
by zorbathut
Sat Nov 30, 2002 1:17 pm
Forum: C++
Topic: Bigint
Replies: 37
Views: 17172

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-lib...
by zorbathut
Fri Nov 29, 2002 11:02 pm
Forum: C++
Topic: Bigint
Replies: 37
Views: 17172

I think the question you should be asking is, is this a language competition or a problem-solving competition?

Because unless part of the goal of this is to face different languages off against each other, it does seem to make sense to give each language the same basic abilities (if possible).
by zorbathut
Thu Nov 28, 2002 2:59 am
Forum: Algorithms
Topic: Probability problem
Replies: 0
Views: 1758

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...
by zorbathut
Wed Nov 27, 2002 10:33 am
Forum: C++
Topic: Bigint
Replies: 37
Views: 17172

*laughs* neat. Thanks :)
by zorbathut
Wed Nov 27, 2002 3:41 am
Forum: C++
Topic: Bigint
Replies: 37
Views: 17172

Probably the best example I've ever seen of a library that needs operator overloading ;) Maybe I should write a wrapper class . . .
by zorbathut
Wed Nov 06, 2002 9:17 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 182730

I'd be a little worried about mixing cin and printf. Might work. I *know* that mixing scanf/cin or printf/cout is a bad idea, but if you used one for input and the other for output, it might or might not work. In any case, your basic structure (the loop and EOF detection) is fine. Once you're calcul...
by zorbathut
Wed Nov 06, 2002 6:41 am
Forum: Volume 1 (100-199)
Topic: 105 - The Skyline Problem
Replies: 160
Views: 27752

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 su...
by zorbathut
Wed Nov 06, 2002 12:03 am
Forum: C++
Topic: ANSI C++ Manual
Replies: 5
Views: 3262

MSVC++6 isn't terribly good, but MSVC.NET has an option for basically full ANSI compatibility - look through the project settings for "Disable Microsoft Extensions", as I remember, and that'll do it. MSVC.NET is what I use for competitions if I can. :)
by zorbathut
Tue Nov 05, 2002 11:55 pm
Forum: Algorithms
Topic: Longest path
Replies: 5
Views: 4437

"guest". augh. how did it log me in as guest? :P If it's NP-complete, there's not going to be any greedy method, or indeed, any method at all that runs in less than exponential time. (Okay, this hasn't been *proven* yet, but you're not going to find one :P) You might be able to come up with a soluti...
by zorbathut
Tue Nov 05, 2002 8:55 am
Forum: Algorithms
Topic: Generating Combinations
Replies: 5
Views: 3593

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 ...
by zorbathut
Tue Nov 05, 2002 6:50 am
Forum: C++
Topic: C++ Skeleton
Replies: 7
Views: 3718

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,...
by zorbathut
Tue Nov 05, 2002 6:46 am
Forum: C++
Topic: Bigint
Replies: 37
Views: 17172

The way I've always looked at it, classes *can* make just as good and fast and easy code as without, but it's really easy to screw it up and end up with slow code. I use classes when they come in handy (which so far hasn't been once on this site, but then, I've only done seven problems or so) withou...

Go to advanced search