一直在想丝帛题要不要贴呢...后来觉得还是贴了吧...反正没人看...blog是开给自己看的...偶尔无聊打打blog也显得生活非常充实...
题意:
给一个gcd和lcm求满足啊他们的最小的a和b.
SOL:
还想着质因数分解来着...转念一想比gcd小的数的gcd也不能变成G啊...这不是丝帛么...那最小的不就是gcd么...
数论用几个丝帛题开头好了 = =...
Code:
#include #include #include int main() { int n,G,L; while ( scanf("%d",&n) !&#61; EOF ) for ( int t &#61; 1 ; t <&#61; n ; &#43;&#43; t ) { scanf("%d%d",&G,&L); if ( L%G &#61;&#61; 0 ) printf("%d %d\n",G,L); else printf("-1\n"); } return 0; }
转:https://www.cnblogs.com/YCuangWhen/p/5260442.html