Sixth Grade Math
Time Limit: 1000MS |
Memory Limit: 65535KB |
Submissions: 162 |
Accepted: 120 |
Sample Input
Sample Output
1 10 5
2 161 1
3 168 14
#include<stdio.h>
int main()
{
int n,i;
int a[1000],b[1000];
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d%d",&a[i],&b[i]);
}
for(i=1;i<=n;i++)
{
int da,xiao,yu;
if(a<b)
{
int t=a[i];
a[i]=b[i];
b[i]=t;
}
da=a[i];
xiao=b[i];
while(b[i])
{
yu=a[i]%b[i];
a[i]=b[i];
b[i]=yu;
}
printf("%d %d %d
",i,da*xiao/a[i],a[i]);
}
return 0;
}