diff options
Diffstat (limited to '01_introductory_problems/coin_piles_1754.cpp')
| -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 | } | ||
