Thursday, February 09, 2006

well.. took noi test yesterday... from 3.30pm to 10.30pm.. * yawn * got back at 12.20 manzzZ.
well i got 5th... so im in.. so yay! ^^

but i feel i could have done better.. a lot better.. esp on counting triangles.. where i scored 10/100... sighh.. so i went to analyse possible mistakes.. and those i found were... quite bad.

Count.exe:
my N choose R function made me put a 31! into a maximum 2^32 integer... for those who don't understand... i tried to put a 32 digit number into a memory size suited for a max 10-digit... worst part is... the way to work around it is so simple... the code is shorter than the wrong one!!! gragh..

for (c2=2; c2<(line+1); c2++)
//n!... basically where i end up with the 33!

a= a*c2;
for (c2=2; c2<(line-2); c2++)
//(n-3)! ..

b= b*c2;
c= (a / b) / 6;

for (c1=(line-2); c1<(line+1); c1++)
//n(n-1)(n-2) ... max 32736. -_-"

a= a * c1;
c= a / 6;

Prawn.exe:
...for loop at the end of the program is supposed to pick the n highest variables and subtract them... sounds simple? i thot so too... but my for loop subtracts the highest variable n times!!! w333...

.... could have easily gotten 2nd or 3rd... and about double my score. oh wells reflection over. time for some sleep. ~yeahh~ sleep.

No comments: