B. Obtain Two Zeroes

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

You are given two integers aa and bb. You may perform any number of operations on them (possibly zero).

During each operation you should choose any positive integer xx and set a:=a−xa:=a−x, b:=b−2xb:=b−2x or a:=a−2xa:=a−2x, b:=b−xb:=b−x. Note that you may choose different values of xx in different operations.

Is it possible to make aa and bb equal to 00 simultaneously?

Your program should answer tt independent test cases.

Input

The first line contains one integer tt (1≤t≤1001≤t≤100) — the number of test cases.

Then the test cases follow, each test case is represented by one line containing two integers aa and bb for this test case (0≤a,b≤1090≤a,b≤109).

Output

For each test case print the answer to it — YES if it is possible to make aa and bb equal to 00 simultaneously, and NO otherwise.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).

Example
input

Copy
3
6 9
1 1
1 2
output

Copy
YES
NO
YES
Note

In the first test case of the example two operations can be used to make both aa and bb equal to zero:

  1. choose x=4x=4 and set a:=a−xa:=a−x, b:=b−2xb:=b−2x. Then a=6−4=2a=6−4=2, b=9−8=1b=9−8=1;
  2. choose x=1x=1 and set a:=a−2xa:=a−2x, b:=b−xb:=b−x. Then a=2−2=0a=2−2=0, b=1−1=0b=1−1=0.

题解:

CODE:

#include<iostream>
using namespace std;
int m ,n;
int main()
{
int t;
cin>>t;
for(int i=;i<t;++i)
{
cin>>m>>n;
if(m>n)swap(m,n);
if((m+n)%!=||*m<n)
{
cout<<"NO"<<endl;
}
else
{
cout<<"YES"<<endl;
}
}
return ;
}

最新文章

  1. nginx源码分析之hash的实现
  2. git submodule初用
  3. iOS开发之画图板(贝塞尔曲线)
  4. [译] MongoDB Java异步驱动快速指南
  5. CSS样式--实际开发总结
  6. 【转】给Windows + Apache 2.2 + PHP 5.3 安装PHP性能测试工具 xhprof
  7. Apache配置中的ProxyPass 和 ProxyPassReverse
  8. 安卓系统上安装.net运行时 mono runtime
  9. Swift定义单例
  10. cocos2dx 网络编程(CCHttpRequest和CURL两个方式)
  11. Keil C51基本数据类型
  12. [wordpress]后台自定义菜单字段和使用wordpress color picker
  13. c#-委托,匿名方法,lambda表达的关系
  14. 关于Java解压文件的一些坑及经验分享(MALFORMED异常)
  15. oracle的卸载
  16. 模组 前后端分离CURD 组件
  17. Android 如何解决dialog弹出时无法捕捉Activity的back事件
  18. Centos 7内核3升级到4
  19. 【WPF】ListBox GridViewColumn Header 文字换行、文字多行显示
  20. Js数组里剔除指定的元素(不是指定的位置)

热门文章

  1. PostgreSQL设计之初的大量论文
  2. 正斜杠&quot;/&quot;与反斜杠&quot;\&quot;
  3. Springboot+Jedis+Ehcache整合
  4. Redis主从架构核心原理
  5. WPF拖拽文件(拖入拖出),监控拖拽到哪个位置,类似百度网盘拖拽
  6. Chrome开发者工具详解(四)之Elements、Console、Sources面板
  7. Django中间件拦截未登录url
  8. 四、VLC搭建rtsp服务器
  9. 服务器上搭建jupyter notebook
  10. spring security There was an unexpected error (type=Forbidden, status=403).