zoukankan      html  css  js  c++  java
  • Business Cards UVALive

    只能由三种情况

    都横着放  都竖着放  横和竖交错放

    那就去判断好了。。。 具体看代码

    #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
    ");
            else if(c % b == 0 && d % a == 0) printf("YES
    ");
            else if(c % a == 0 && c % b == 0 && check(a, b, d)) printf("YES
    ");
            else if(d % a == 0 && d % b == 0 && check(a, b, c)) printf("YES
    ");
            else printf("NO
    ");
    
        }
        return 0;
    }
    自己选择的路,跪着也要走完。朋友们,虽然这个世界日益浮躁起来,只要能够为了当时纯粹的梦想和感动坚持努力下去,不管其它人怎么样,我们也能够保持自己的本色走下去。
  • 相关阅读:
    Django项目上线的准备工作
    Centos安装MySQL5.6并重置密码
    Centos7.4下安装Python3
    Django单表查询及其方法
    thinkphp 视图模型使用分析
    thinkphp 统计某个字段不重复数 总数
    表结构相同的表,且在同一数据库 数据复制
    crontab 定时任务 每过多少分钟执行
    js event事件
    shell 验证ip
  • 原文地址:https://www.cnblogs.com/WTSRUVF/p/9334837.html
Copyright © 2011-2022 走看看