SummerSky's blog

By SummerSky, 7 years ago, In English

203A - Two Problems

A simple simulation problem, but be careful that one could solve 0, 1, or 2 problems.

203B - Game on Paper

Once a square becomes black, we check all the 3 * 3 areas (in fact there 9 such areas) which contain it, to see whether they are all black. The complexity is O(M).

203C - Photographer

A straightforward greedy algorithm solves this problem.

203D - Hit Ball

We can consider each of the three dimensions independently. At first, we can calculate when it hits the door according to vy. Then, we calculate the total distance that it goes along the x and y dimension, respectively, assuming that no reflection occurs. It can be observed that for x dimension, the distance has a cycle of length 2a while for y dimension, the cycle has length 2b. Therefore, we “eliminate” a multiple of cycles from the total distance and it is then simple to determine the final position, according to the “residual” distance.

  • Vote: I like it
  • 0
  • Vote: I do not like it