Friday, February 18, 2011

11388 - GCD LCM


#include<stdio.h>
int main()
{
    int t,g,l;
    //freopen("in.txt","r",stdin);
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d%d",&g,&l);
        if(l%g)
            printf("-1\n");
        else
            printf("%d %d\n",g,l);
    }
    return 0;
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.