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

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

This document contains solutions to 5 problems from the American Computer Science League Contest #1 Senior Division. 1. The value of the recursive function f(12,66) is calculated to be 4279. 2. The value of the recursive function f(10) is calculated to be 1535. 3. Evaluating the numeric expression 1012 = 5 328 = 26 2416 = 36 1112 = 7 in base 10 gives the solution 23516 or 235. 4. Solving the equation 1X616 = 256 + 16X + 6 for X gives the solution X = 5. 5. Evaluating the LISP expression (CDR(CAR(CDR(RE

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)
54 views1 page

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

This document contains solutions to 5 problems from the American Computer Science League Contest #1 Senior Division. 1. The value of the recursive function f(12,66) is calculated to be 4279. 2. The value of the recursive function f(10) is calculated to be 1535. 3. Evaluating the numeric expression 1012 = 5 328 = 26 2416 = 36 1112 = 7 in base 10 gives the solution 23516 or 235. 4. Solving the equation 1X616 = 256 + 16X + 6 for X gives the solution X = 5. 5. Evaluating the LISP expression (CDR(CAR(CDR(RE

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


Senior Division Solutions

1. Recursive Functions 1. 4279


f (12,66) = f (132,2) – 12 = 4279
f (132,2) = f (2,66) + 2 = 4291
f (2,66) = f (66,1) – 2 = 4289
f (66,1) = 662 – 1*66 + 12 = 4291

2. Recursive Functions 2. 1535


f (1) = 2
f (2) = 2* f (1) + 1 = 2*2 + 1 = 5
f (3) = 2* f (2) + 1 = 2*5 + 1 = 11
f (4) = 2* f (3) + 1 = 2*11 + 1 = 23

f (10) = 2* f (9) + 1 = 2*767 + 1 = 1535

3. Computer Number Systems


1012 = 5 328 = 26 2416 = 36 1112 = 7 3. 23516 or 235
The expression in base 10 is: 5 * 26 + 15 (36 – 7) = 565 = 23516

4. Computer Number Systems


1X616 = 256 + 16X + 6 = 262 + 16X 4. 5
X268 = 64X + 16 + 6 = 64X + 22
Therefore 64X + 22 = 16X + 262
48X = 240
X=5

5. LISP 5. (1)
(CDR(CAR(CDR(REVERSE(CDR ‘((2 3)(1 2)((2 3)1)2))))))
= (CDR(CAR(CDR(REVERSE ‘((1 2)((2 3)1)2)))))
= (CDR(CAR(CDR ‘(2((2 3)1)(1 2)))))
= (CDR(CAR ‘(((2 3)1)(1 2))))
= (CDR ‘((2 3)1))
= (1)

You might also like