zoukankan      html  css  js  c++  java
  • SCAU 8619 公约公倍

    8619 公约公倍

    时间限制:500MS  内存限制:1000K 提交次数:63 通过次数:19

    题型: 编程题   语言: 无限制

    Description

    给定六个正整数a,b,c,d,e,f;问你是否存在整数既是a,b,c的最大公约的倍数,同时又是d,e,f的最小公倍数的约数。

    Input

    输入为多case输入,每个case只有一行,每行六个正整数。当输入6个0时结束。

    Output

    存在输出YES,否则输出:NO

    Sample Input

    32 40 16 20 30 24
    0 0 0 0 0 0
    
    

    Sample Output

    YES

    Hint

    32,40,16的最大公约数是:8;而20,30,24的最小公倍数为120,显然存在整数(如24),既是8的倍数,又是120的约数

    Source

    jiangju0

    Provider

    admin

     

    #include<stdio.h>
    int max_int(int m, int n)
    {
        int temp;
        if(m<n) {temp = m; m = n; n = temp;}
        while(m%n != 0)
        {
            temp = m%n;
            m = n;
            n = temp;
        }
        return n;
    }
    
    int main()
    {
        int a, b, c, d, e, f;
        int  min, max;
        int temp;
        while(scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f))
        {
            if(!a && !b && !c && !d && !e && !f) break;
            max = max_int(a, b);
            max = max_int(max, c);
            min = max_int(d, e);
            temp = d*e/min;
            min = max_int(temp, f);
            temp = temp*f/min;
            if(temp%max == 0) printf("YES\n");
            else printf("NO\n");
        }
        return 0;
    } 

    解题报告:
    如果提交了,那就WA了,如果AC了,那么你找OJ的问题去

  • 相关阅读:
    关于微服务的协议概述
    Eclipse 安装阿里巴巴代码规范插件
    Eclipse安装LomBok插件
    关于JAVA架构师
    关于Object类的一些方法
    [SoapUI] SoapUI官方文档
    [Jmeter] 用xsltproc生成html格式的报告
    [RF] Robot Framework新手干货(转载)
    【SoapUI】比较Json response
    怎样查看一个端口有无开启
  • 原文地址:https://www.cnblogs.com/liaoguifa/p/2770410.html
Copyright © 2011-2022 走看看