zoukankan      html  css  js  c++  java
  • UVa 11388 & 丝帛

    一直在想丝帛题要不要贴呢...后来觉得还是贴了吧...反正没人看...blog是开给自己看的...偶尔无聊打打blog也显得生活非常充实...

     题意:

      给一个gcd和lcm求满足啊他们的最小的a和b.

     SOL:

      还想着质因数分解来着...转念一想比gcd小的数的gcd也不能变成G啊...这不是丝帛么...那最小的不就是gcd么...

      数论用几个丝帛题开头好了 = =...

      

      Code:

        #include <cstdio>  
        #include <cstdlib>  
        #include <cstring>  
          
        int main()  
        {  
            int n,G,L;   
            while ( scanf("%d",&n) != EOF )   
                for ( int t = 1 ; t <= n ; ++ t ) {  
                    scanf("%d%d",&G,&L);  
                    if ( L%G == 0 )   
                        printf("%d %d
    ",G,L);  
                    else printf("-1
    ");  
                }  
            return 0;  
        }  
    
    Sometimes it s the very people who no one imagines anything of. who do the things that no one can imagine.
  • 相关阅读:
    函数
    文件
    字符编码
    卸载python
    mysql修改密码
    playbook
    expect无交互操作
    用户认证
    配置并访问NFS共享
    配置Multipath多路径环境
  • 原文地址:https://www.cnblogs.com/YCuangWhen/p/5260442.html
Copyright © 2011-2022 走看看