2000 Canadian Computing Competition, Stage 1

Problem S4: Golf

Roberta the Robot plays a perfect game of golf. When she hits the golf ball it always goes directly towards the hole on the green, and she always hits exactly the distance that is specified for the club. Each such action is known as a stroke, and the object of golf is to hit the ball from the tee to the hole in the fewest number of strokes. Roberta needs a program to select the best combination of clubs to reach the hole in the fewest strokes. She also needs to decide if the task is impossible, in which case she graciously acknowledges the loss. Roberta can carry up to 32 clubs, and the total distance from the tee to the hole does not exceed 5280 metres.

Input

The first line of input gives the distance from the tee to the hole, an integral number of metres between 1 and 5280. The next line states the number of clubs, between 1 and 32. For each club, a line follows giving the distance, in metres, that the club will hit the ball, an integer between 1 and 100. No two clubs have the same distance.

Output

If Roberta can get the ball from the tee to the hole, without passing the hole, print "Roberta wins in n strokes." where n is minimized. If Roberta cannot get the ball from the tee to the hole, print "Roberta acknowledges defeat.".

Sample Input

100 
3 
33 
66 
1 

Sample Output

Roberta wins in 3 strokes. 

All Submissions
Best Solutions


Point Value: 10
Time Limit: 2.00s
Memory Limit: 16M
Added: Sep 29, 2008

Problem Types: [Show]

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

<
1
2
>

Can someone please teach me recursion!?!?!? I'm so screwed

someone needs to give him a hug.

he doesnt know recursion :'(

i thought I told you earlier on today that DFS IS RECURSION!!!! USACO WILL NEVER GIVE YOU A PROBLEM THAT INVOVLES CONCEPTS YOU HAVE'T LEARNED YET!!!!!!!!!!!!

perhaps you are lacking in the "brainpower" category.

It's DFS. Not DPS.

DFS stands for Depth-First Search.