about summary refs log tree commit diff
path: root/daily/303easy/README.md
diff options
context:
space:
mode:
authorRaphael McSinyx <vn.mcsinyx@gmail.com>2017-02-28 20:16:22 +0700
committerRaphael McSinyx <vn.mcsinyx@gmail.com>2017-02-28 20:16:22 +0700
commit1cfc8e7ba45619f8a9837b4438c609948800dfff (patch)
treefe781b2edbd88fd9d6f00b16cb3354ecae14bbd2 /daily/303easy/README.md
parentb7e55e6510690093d61f9cc1152e0330e55fe90b (diff)
downloadcp-1cfc8e7ba45619f8a9837b4438c609948800dfff.tar.gz
Add /r/dailyprogrammer Challenge #303 [Easy]
Diffstat (limited to 'daily/303easy/README.md')
-rw-r--r--daily/303easy/README.md58
1 files changed, 58 insertions, 0 deletions
diff --git a/daily/303easy/README.md b/daily/303easy/README.md
new file mode 100644
index 0000000..b970342
--- /dev/null
+++ b/daily/303easy/README.md
@@ -0,0 +1,58 @@
+# [[2017-02-21] Challenge #303 [Easy] Ricochet](https://www.reddit.com/r/dailyprogrammer/comments/5vb1wf/20170221_challenge_303_easy_ricochet/)
+
+## Description
+
+Start with a grid _h_ units high by _w_ units wide. Set a point particle in
+motion from the upper-left corner of the grid, 45 degrees from the horizontal,
+so that it crosses from one corner of each unit square to the other. When the
+particle reaches the bounds of the grid, it ricochets and continues until it
+reaches another corner. 
+
+Given the size of the grid (_h_ and _w_), and the velocity (_v_) of the
+particle in unit squares per second, determine _C_: the corner where the
+particle will stop, _b_: how many times the particle ricocheted off the bounds
+of the grid, and _t_: the time it took for the particle to reach _C_.
+
+## Constraints
+
+The particle always starts from the upper-left corner of the grid (and will
+therefore always end up in one of the other corners).
+
+Since we'll be working with unit squares, _h_ and _w_ are always integers.
+
+## Formal Inputs & Outputs
+
+### Input description
+
+The input will be an arbitrary number of lines containing _h_, _w_, and _v_,
+each separated by spaces:
+
+     8 3 1
+     15 4 2
+
+### Output description
+
+For each line of input, your program should output a line containing _C_, _b_,
+and _t_, where _C_ can be UR, LR, or LL depending on where the particle ends
+up:
+
+     LL 9 24
+     UR 17 30
+
+## Bonus
+
+Instead of a particle, determine the behavior of a rectangle _m_ units high by
+_n_ units wide. Input should be as follows: _h_ _w_ _m_ _n_ _v_. So for a 10 by
+7 grid with a 3 by 2 rectangle, the input would be:
+
+     10 7 3 2 1
+
+The output format is the same:
+
+     LR 10 35
+
+# Finally
+
+Have a good challenge idea like /u/sceleris927 did?
+
+Consider submitting it to /r/dailyprogrammer_ideas