sans-hubris
02-03-2001, 04:42 PM
http://www.uwosh.edu/cs_club/activities/hsprog/2001/
Check it out, the problems are also given.
Check it out, the problems are also given.
|
Click to See Complete Forum and Search --> : High school programming competition results are in sans-hubris 02-03-2001, 04:42 PM http://www.uwosh.edu/cs_club/activities/hsprog/2001/ Check it out, the problems are also given. YaRness 02-03-2001, 05:26 PM that perfect number problem looks hard. i may play with it this afternoon.. i need something to exercise my brain on. sans-hubris 02-04-2001, 09:10 AM For the high schoolers, the Game Genie code interpreter and the maze one seemed to be the hardest. I had actually come up with the text box problem, which I thought was pretty easy, but only three teams solved it. The first one we were very proud of, not because of its difficulty, but because of the story describing it. It's pretty funny. The Game Genie problem was actually targeted at Perl programmers, but alas there were no perl programmers at the competition. It was all C/C++, except for one team that use QBASIC. The students were allowed to bring in their own computers for their own programming languages if they so wished, but no one did. [ 04 February 2001: Message edited by: ndogg ] YaRness 02-04-2001, 10:07 AM that's weird, i thought the game genie problem was too easy. though i was thinking a bit of how to minimize the code.. that might a bit more challenging. jjjj 02-05-2001, 01:00 AM Thats pretty cool when I have time, maybe I will try some of those it would be good practice. And I can use all of the practice I can get. :) sans-hubris 02-05-2001, 11:27 AM Originally posted by YaRness: that's weird, i thought the game genie problem was too easy. though i was thinking a bit of how to minimize the code.. that might a bit more challenging. I don't think they had learnt bit manipulation yet, and so it would look very strange to them. YaRness 02-05-2001, 11:37 AM Originally posted by ndogg: I don't think they had learnt bit manipulation yet, and so it would look very strange to them. well duh, that makes sense. i remember totally fearing my bit twiddling class (failed it first time around :( ) [GoRN] 02-05-2001, 11:52 PM i'm in high school, admitted that i'm ahead of my computer class, but i hadn't done bit manipulation, but figured it out. i used a case switch for the converting game genie hex to real and used a int bin[8]; for storing thing binary and then used a for to move it around i had a function int *toBin(int n) and another int toDec(int *n). then yeah if someone could post their code though i would like to see a smaller way of doing this, mine was huge sans-hubris 02-07-2001, 02:31 PM There's an example in PERL on the page, but I guess that doesn't really help any. BTW, in C/C++, I don't think there is a way besides using a switch-case. [ 07 February 2001: Message edited by: ndogg ] jemfinch 02-07-2001, 05:44 PM Originally posted by ndogg: BTW, in C/C++, I don't think there is a way besides using a switch-case. void print_hex_digit_in_binary(int x) { char bin[5]; bin[0] = x & 8 ? '1' : '0'; bin[1] = x & 4 ? '1' : '0'; bin[2] = x & 2 ? '1' : '0'; bin[3] = x % 2 ? '1' : '0'; bin[4] = '\0'; printf("%4s\n", bin); return; } Jeremy Stuka 02-07-2001, 07:21 PM Jeremy- I think he was referring to the conversion of 'Game Genie hex' to real hex notation. Of course if you did this: convert_to_real(string code) { string realhex = "0123456789ABCDEF"; string gghex = "DF4709156BC8A23E"; for (int i=0;i < gghex.length(); ++i) { code[i] = realhex[gghex.find(code[i])]; } } It may not be very fast compared to the switch statement, but it's a lot shorter! [ 07 February 2001: Message edited by: Stuka ] sans-hubris 02-10-2001, 01:04 PM Cool, I didn't think of that (and I don't know if the person who made the prob did either). What would work out real nicely. Once you had the code, then just search the two strings for the appropriate letter and convert. Kayle 02-13-2001, 10:57 PM Here is a C soulition to converting to normal hex. char *convert(char code[]) { int i, j, k = 0; char g_hex[] = {'D','F','4','7','0','9','1','5','6','B','C','8',' A','2','3','E'}; char n_hex[] = {'0','1','2','3','4','5','6','7','8','9','A','B',' C','D','E','F'}; for( i = 0; i < 9; i++) for( j = 0; j < 16; j++) if(code[k] == g_hex[j]) code[k++] = n_hex[j]; return code; } [ 13 February 2001: Message edited by: Kayle ] jemfinch 02-14-2001, 12:18 AM Originally posted by Kayle: char g_hex[] = {'D','F','4','7','0','9','1','5','6','B','C','8',' A','2','3','E'}; That's (almost) the same as char g_hex[] = "DF4709156BC8A23E"; (the only difference is that in my case, there's an extra "\0" on the string.) Here's to less typing :) Jeremy justlinux.com
Copyright Internet.com Inc. All Rights Reserved. |