UVa 114

From Algorithmist

Jump to: navigation, search

Contents

[edit] 114 - Simulation Wizardry

[edit] Summary

Simulate a pinball game according to a set of rules.

[edit] Explanation

Simulate a pinball game according to a set of rules:

  1. If a ball hits a bumper or a wall, turn right 90 degrees.
    1. When a ball hits a bumper, add that the point value of the bumper, and subtract the life value.

[edit] Input

4 4
0
2
2 2 1 0
3 3 1 0
2 3 1 1
2 3 1 2
2 3 1 3
2 3 1 4
2 3 1 5

[edit] Output

0
0
1
2
2
5
Personal tools