commit 307416d626500c07609bacce7522c013bc9e104f parent f6cc5ecf4d3336e8be4e7f455e027a9b2ad1fd5e Author: superpozycja <anna@superpozycja.net> Date: Thu, 24 Oct 2024 00:40:41 +0200 solve coin piles Diffstat:
A | intro/coin_piles.cpp | | | 37 | +++++++++++++++++++++++++++++++++++++ |
1 file changed, 37 insertions(+), 0 deletions(-)
diff --git a/intro/coin_piles.cpp b/intro/coin_piles.cpp @@ -0,0 +1,37 @@ +#include <bits/stdc++.h> + +using namespace std; + +using ui = unsigned int; +using l = long; +using ul = unsigned long; +using ll = long long; +using ull = unsigned long long; + +using vi = vector<int>; +using vui = vector<ui>; +using vl = vector<l>; +using vul = vector<ul>; +using vll = vector<ll>; +using vull = vector<ull>; + +void solve() +{ + int a, b; + cin >> a >> b; + int x = 2 * a - b; + int y = 2 * b - a; + if (x >= 0 && y >= 0 && x % 3 == 0 && y % 3 == 0) + cout << "YES\n"; + else + cout << "NO\n"; + return; +} + +int main() +{ + int t; + cin >> t; + while (t--) + solve(); +}