[nitpick]
the original posting claimed scoring on only:
for the advancedQuote:
Speed: Pedal to the metal
Elegance: Nifty algorithms are always good
[/nitpick]
granted, my score stunk anyway cause I was too hasty in submitting it. :D
Printable View
[nitpick]
the original posting claimed scoring on only:
for the advancedQuote:
Speed: Pedal to the metal
Elegance: Nifty algorithms are always good
[/nitpick]
granted, my score stunk anyway cause I was too hasty in submitting it. :D
>Prelude, would you mind looking at the above and verifying that?
It works nicely for my tests, but still doesn't beat my function in speed. Much better though. :) I'm sure you'll admit that the task was deceptively simple? Beware tricks with me, I'm sneaky. ;)
>the original posting claimed scoring on only:
I know. I gave out those scorings before I had a chance to grade an entry. Usually the ADC will score on the four categories that I did unless stated otherwise. And the first one doesn't count for the stated otherwise rule because I had no clue what I was doing until after it was over. Expect a less chaotic contest next time. BTW, next time should be tonight or tomorrow if I can manage it.
ok, I eagerly await the next one. I'll have to pay more attention to portability in the future as well. Unfortunately, in my job windows-only development is the norm.
edit: oh, and I'll spend more than 5 minutes verifying this one ;)
>I'll have to pay more attention to portability in the future as well.
I take portability very seriously. Even if your job doesn't require it, you should still be aware of what can be used everywhere and what cannot. May I suggest investing in a good lint? :)
Looks good, my only complaint is that my stick solution was listed as beginner and not intermediate in both my critique and the standings at the top.
Thanks Prelude, excellent job on the first contest! :D
Well that static array in your advanced submission is great for speed but not multithreading (what I use a lot). And the function prototype you gave us read 'char' in both the parameter and the return type. So we assumed the function will only handle chars, not wchar_t or anything like that.
Nice job Prelude, you've obviously put a lot of effort into this, so... thanks :)
My nitpick (everyone is allowed one, right?), is this:
Quote:
Beginner Contest Rules:
Your function should work for every valid int from INT_MAX to INT_MIN.
The sign was a requirement, and if your code didn't cater for it, it'd be wrong (imho). But hey, its only for fun :)Quote:
Hammer used the divide and conquer () algorithm that most everyone seemed to prefer for this task. The only real difference is that he took into account the sign as well. This wasn't a requirement, but it's still a nice gesture.
>The sign was a requirement, and if your code didn't cater for it, it'd be wrong (imho).
I meant that I didn't specify how it was to be dealt with. I didn't say to remove it, did I? ;)
Hey Prelude, Lucifuri0us was me. I put a comment at the top of the code, but I guess it wasnt so obvious.
>I chose the obvious solution because the not so obvious solution was dreadfully slow. Both produced correct output
Hmmm. The not so obvious solution is slower in general, but if the string was, say, 100 million characters, the not so obvious one would have been much faster since it only iterated through the string once. Shouldnt I have gotten credit for originality? ;)
Thanks for all the effort you put into this contest.
One question...
Let's say I have
Would that get optimized into:Code:int main() {
char stuff[33001];
memset(stuff,0,33000*sizeof(char));
//...
return 0;
}
by the compiler?Code:int main() {
char stuff[33001] = { 0,0,0,0, ..... ,0 };
//...
return0;
}
wow.. this was a contest... Great reviews..
Sorry for the unnecessary commenting.. Picked that up in high school where our teachers insited we comment each line... sorry..
And some suggestions
-----------------------------
How about the contst page having daily stastics.. Like number of people etc etc with score grade etc and some kind of ranking system. which would be carried on throughout the contest..
How a compiler converts syntax varies between different compilers......but if memset was implemented as a function, you would see a call (assuming 0x86).....Quote:
Originally posted by ygfperson
One question...
Let's say I have
Would that get optimized into:Code:int main() {
char stuff[33001];
memset(stuff,0,33000*sizeof(char));
//...
return 0;
}
by the compiler?Code:int main() {
char stuff[33001] = { 0,0,0,0, ..... ,0 };
//...
return0;
}