Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace app
- {
- public struct Pair
- {
- public int A;
- public int B;
- public Pair(int a, int b)
- {
- this.A = a;
- this.B = b;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- var count = Convert.ToInt32(Console.ReadLine());
- var list = new List<Pair>();
- for (int i = 0; i < count; ++i)
- {
- var input = Console.ReadLine().Split();
- var pair = new Pair(Convert.ToInt32(input[0]), Convert.ToInt32(input[1]));
- list.Add(pair);
- }
- foreach (var pair in list)
- {
- Console.WriteLine(GetTwoZeros(pair.A, pair.B));
- }
- }
- public static string GetTwoZeros(int a, int b)
- {
- var compare = (b >= a) ? GetCompare(a, b) : GetCompare(b, a);
- if ((a >= 0 && b >= 0) && compare && VerifyCondition(a, b) && VerifyCondition(b, a))
- {
- return "YES";
- }
- return "NO";
- }
- public static bool VerifyCondition(int first, int second)
- {
- return (2 * first - second) % 3 == 0;
- }
- private static bool GetCompare(int min, int max)
- {
- return max >= 0 && max <= 2 * min;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement