diff options
Diffstat (limited to '2024/14/day14a.cpp')
| -rw-r--r-- | 2024/14/day14a.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/2024/14/day14a.cpp b/2024/14/day14a.cpp new file mode 100644 index 0000000..dff0ae9 --- /dev/null +++ b/2024/14/day14a.cpp | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | #include <algorithm> | ||
| 2 | #include <cstdint> | ||
| 3 | #include <iostream> | ||
| 4 | #include <map> | ||
| 5 | #include <ranges> | ||
| 6 | #include <set> | ||
| 7 | #include <sstream> | ||
| 8 | #include <string> | ||
| 9 | #include <string_view> | ||
| 10 | #include <vector> | ||
| 11 | using namespace std; | ||
| 12 | |||
| 13 | #define N 101 | ||
| 14 | #define M 103 | ||
| 15 | #define T 100 | ||
| 16 | |||
| 17 | int quadrant(pair<int64_t, int64_t> p) { | ||
| 18 | if (p.first < N/2 && p.second < M/2) | ||
| 19 | return 1; | ||
| 20 | if (p.first < N/2 && p.second > M/2) | ||
| 21 | return 2; | ||
| 22 | if (p.first > N/2 && p.second < M/2) | ||
| 23 | return 3; | ||
| 24 | if (p.first > N/2 && p.second > M/2) | ||
| 25 | return 4; | ||
| 26 | return 0; | ||
| 27 | } | ||
| 28 | |||
| 29 | int main() { | ||
| 30 | string line; | ||
| 31 | int64_t p1, p2, v1, v2, q[5] = {0}; | ||
| 32 | while (cin >> p1 >> p2 >> v1 >> v2) { | ||
| 33 | pair<int64_t, int64_t> final((p1 + T*(v1+N)) % N, (p2 + T*(v2+M)) % M); | ||
| 34 | q[quadrant(final)]++; | ||
| 35 | } | ||
| 36 | |||
| 37 | cout << q[1] * q[2] * q[3] * q[4] << endl; | ||
| 38 | |||
| 39 | return 0; | ||
| 40 | } | ||
