diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-07-06 19:08:08 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-07-06 19:08:08 +0200 |
| commit | 96254947699986c59f0dc63d69fd4b76bd3ed43e (patch) | |
| tree | 6c4dca945d7f7427c48be234d827fe4d33be02c5 /01_introductory_problems/coin_piles_1754.cpp | |
| download | cses-96254947699986c59f0dc63d69fd4b76bd3ed43e.tar.gz cses-96254947699986c59f0dc63d69fd4b76bd3ed43e.zip | |
Initial commit
Diffstat (limited to '')
| -rw-r--r-- | 01_introductory_problems/coin_piles_1754.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/01_introductory_problems/coin_piles_1754.cpp b/01_introductory_problems/coin_piles_1754.cpp new file mode 100644 index 0000000..c54cdf1 --- /dev/null +++ b/01_introductory_problems/coin_piles_1754.cpp | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #include <algorithm> | ||
| 2 | #include <iostream> | ||
| 3 | |||
| 4 | bool f(int a, int b) { | ||
| 5 | auto max = std::max(a, b); | ||
| 6 | auto min = std::min(a, b); | ||
| 7 | |||
| 8 | return max <= 2*min && (2*min - max) % 3 == 0; | ||
| 9 | } | ||
| 10 | |||
| 11 | int main() { | ||
| 12 | int t, a, b; | ||
| 13 | std::cin >> t; | ||
| 14 | for (int i = 0; i < t; i++) { | ||
| 15 | std::cin >> a >> b; | ||
| 16 | std::cout << (f(a, b) ? "YES" : "NO") << std::endl; | ||
| 17 | } | ||
| 18 | } | ||
