标签:define algorithm pen rds tor mat fine std freopen
只能由三种情况
都横着放 都竖着放 横和竖交错放
那就去判断好了。。。 具体看代码
#include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set> #include <vector> #include <stack> #include <queue> #include <algorithm> #include <cmath> #define MOD 2018 #define LL long long #define ULL unsigned long long #define Pair pair<int, int> #define mem(a, b) memset(a, b, sizeof(a)) #define _ ios_base::sync_with_stdio(0),cin.tie(0) //freopen("1.txt", "r", stdin); using namespace std; const int maxn = 10010, INF = 0x7fffffff; int check(LL a, LL b, LL x) { if(a < b) swap(a, b); //可以减少循环次数 for(LL i=a; i<x; i+=a) if(!((x - i) % b)) return 1; return 0; } int main() { int T; LL a, b, c, d; scanf("%d",&T); while(T--) { scanf("%lld%lld%lld%lld",&a,&b,&c,&d); if(c % a == 0 && d % b == 0) printf("YES\n"); else if(c % b == 0 && d % a == 0) printf("YES\n"); else if(c % a == 0 && c % b == 0 && check(a, b, d)) printf("YES\n"); else if(d % a == 0 && d % b == 0 && check(a, b, c)) printf("YES\n"); else printf("NO\n"); } return 0; }
Business Cards UVALive - 4384(画图看图。。)
标签:define algorithm pen rds tor mat fine std freopen
原文地址:https://www.cnblogs.com/WTSRUVF/p/9334837.html