aboutsummaryrefslogtreecommitdiff
path: root/01_introductory_problems/coin_piles_1754.cpp
blob: c54cdf1f43187e308798fc1904369045493eac0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <algorithm>
#include <iostream>

bool f(int a, int b) {
	auto max = std::max(a, b);
	auto min = std::min(a, b);

	return max <= 2*min && (2*min - max) % 3 == 0;
}

int main() {
	int t, a, b;
	std::cin >> t;
	for (int i = 0; i < t; i++) {
		std::cin >> a >> b;
		std::cout << (f(a, b) ? "YES" : "NO") << std::endl;
	}
}

Generated with cgit - Back to sebastiano.tronto.net