aboutsummaryrefslogtreecommitdiff
path: root/01_introductory_problems/coin_piles_1754.cpp
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-07-06 19:08:08 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2026-07-06 19:08:08 +0200
commit96254947699986c59f0dc63d69fd4b76bd3ed43e (patch)
tree6c4dca945d7f7427c48be234d827fe4d33be02c5 /01_introductory_problems/coin_piles_1754.cpp
downloadcses-96254947699986c59f0dc63d69fd4b76bd3ed43e.tar.gz
cses-96254947699986c59f0dc63d69fd4b76bd3ed43e.zip
Initial commit
Diffstat (limited to '01_introductory_problems/coin_piles_1754.cpp')
-rw-r--r--01_introductory_problems/coin_piles_1754.cpp18
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
4bool 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
11int 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}

Generated with cgit - Back to sebastiano.tronto.net