ADC #2 Results

This is a discussion on ADC #2 Results within the Contests Board forums, part of the Community Boards category; Originally posted by Prelude >I don't have access to the microsoft C compiler, but GCC compiles it with no errors. ...

  1. #16
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    Originally posted by Prelude
    >I don't have access to the microsoft C compiler, but GCC compiles it with no errors.
    I was in a hurry and didn't test it on GCC. However, VC++ 6 didn't like your use of max as a macro, nor your use of snprintf (which is only standard in C99). However, it is fast now that I've tested it, but it has a few problems with long strings of 0's. I'll update the scores.
    k, thanks.

  2. #17
    Registered User
    Join Date
    Jan 2002
    Posts
    552
    Hey Prelude, do you turn off compiler optimizations when you test the code?

    Heres the source for those who care. I hope you can understand it, I didnt do hardly any commenting
    Attached Files Attached Files
    C Code. C Code Run. Run Code Run... Please!

    "Love is like a blackhole, you fall into it... then you get ripped apart"

  3. #18
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    I'm just wondering...

    Which would have been faster: using 4-byte integers to store 9 base-10 digits, or using all of the integer to hold a number? (ie: filling it with 32 base-2 digits)

  4. #19
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >Hey Prelude, do you turn off compiler optimizations when you test the code?
    Yes.

    >Which would have been faster: using 4-byte integers to store 9 base-10 digits, or using all of the integer to hold a number?
    It's easier to work with n base-10 digits than n base-2. You would have to jump through some hoops for base-2 and that could potentially slow things down, not to mention confuse the hell out of some readers.
    My best code is written with the delete key.

  5. #20
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Originally posted by Prelude
    Kudos to golfinguy who, sadly, submitted too late to be judged. However, the entry was creative (if difficult to expand upon and dangerous with unchecked array boundaries):
    Code:
    //very simple, just a look-up table
    int palNum(int i)
    {     static int array[50]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 11, 33, 44, 55, 66, 77, 88, 99,
                          121, 22, 33 ,22, 55, 66, 77, 88, 99, 121, 121, 33, 44, 55, 33, 77, 88,
                          99, 121, 121, 363, 44, 55, 66, 77, 44, 99, 121, 121, 363, 484};
          return *(array + i);
    }
    Yeah, I took your words to heart.


    EDIT: BTW, what would that have scored?
    Last edited by golfinguy4; 08-10-2003 at 07:55 PM.

  6. #21
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >BTW, what would that have scored?
    It could likely have won.
    My best code is written with the delete key.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 72hour GDC Results
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 07-05-2004, 11:46 PM
  2. ADC #4 Results
    By Prelude in forum Contests Board
    Replies: 9
    Last Post: 08-28-2003, 01:38 PM
  3. ADC #3 Results
    By Prelude in forum Contests Board
    Replies: 19
    Last Post: 08-18-2003, 11:25 PM
  4. ADC #1 Results
    By Prelude in forum Contests Board
    Replies: 26
    Last Post: 08-06-2003, 03:57 AM
  5. Same seed for srand yields different results
    By codegirl in forum C++ Programming
    Replies: 3
    Last Post: 06-23-2003, 02:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21