题解 | 小红走网格

小红走网格

https://www.nowcoder.com/practice/43498993d39246c58e35ca715faea7ab

//  #牛客春招刷题训练营# https://www.nowcoder.com/discuss/726480854079250432
#include <algorithm>
#include <iostream>
using namespace std;
int gcd(int x, int y){//---------gcd(x,y)是xy能通过加减组合出的最小的数;
  while(y){
    int temp = x % y;
    x = y;
    y = temp;
  }
  return x;
}
int main() {
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  int T;
  cin >> T;
  while(T--)
  {
    int x, y, a, b, c, d;
    cin >> x >> y >> a >> b >> c >> d;
    if (x % (gcd(max(c, d), min(c, d))) == 0 && y % (gcd(max(a, b), min(a, b))) == 0) cout << "YES\n";//--------如果x是gcd(c,d)的整数倍表示可以通过组合c,d取得x
    else cout << "NO\n";
  }
}
// 64 位输出请用 printf("%lld")

#牛客春招刷题训练营##写题解领奖励#
全部评论

相关推荐

12-18 19:36
已编辑
门头沟学院 Java
程序员牛肉:可以的,简历没毛病了。 虽然还是偏向同质化,不过学历不错。后续我觉得重心放到刷实习+摆脱同质化问题上
实习简历求拷打
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务