0% found this document useful (0 votes)
19 views1 page

American Computer Science League Intermediate Division Solutions 2007 - 2008 Contest #1

Uploaded by

CK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views1 page

American Computer Science League Intermediate Division Solutions 2007 - 2008 Contest #1

Uploaded by

CK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

ACSL

2007 - 2008 American Computer Science League Contest #1


Intermediate Division Solutions

1. Recursive Functions
f (32) = f (32/2) − 1) + 3 = f (15) + 3 = 7 + 3 = 10
1. 10
f (15) = 2 * f (15-3) – 5 = 2 * f (12) – 5 = 2 * 6 – 5 = 7
f (12) = f (12/2 − 1) + 3 = f (5) + 3 = 3 + 3 = 6
f (5) = 2 * f (5 − 3) –5 = 2 * f (2) – 5 = 2 * 4 – 5 = 3
f (2) = f (2/2 − 1) + 3 = f (0) + 3 = 1 + 3 = 4
f (0) = f (0/2 − 1)) + 3 = f (−1) + 3 = −2 + 3 = 1
f (−1) = ( −1)2 – 3 = 1 – 3 = −2

2. 68
2. Recursive Functions
f (1) = 8 Þ f (2) =2* f (1) – 4 = 12
f (2) = 12 Þ f (3) = 2* f (2) – 4 = 20
f (3) = 20 Þ f (4) = 2* f (3) – 4 = 36
f (4) = 36 Þ f (5) = 2* f (4) – 4 = 68

3. Computer Number Systems


1555558 = 1 101 101 101 101 1012 11 1’s 3. 1333378 or 133337 or B
1333378 = 1 011 011 011 011 1112 12 1’s
1455478 = 1 100 101 101 100 1112 10 1’s
1564648 = 1 101 110 100 110 1002 9 1’s
1714428 = 1 111 001 100 100 0102 8 1’s

4. Computer Number Systems 4. 1001010102


2438 = 163 9116 = 145 8216 = 130 11012 = 13 or 100101010
So the expression in base 10 is 163 + 145 – 130 / 13 = 298
and 298 = 1001010102

5. LISP 5. 24

(ADD (ADD 3 4)(SUB 5 2)(MULT 3 2)(EXP 2 3))


= (ADD 3 + 4 5 – 2 3*2 23)
= (ADD 7 3 6 8)
= 24

You might also like