Skip to content

Instantly share code, notes, and snippets.

@vaishaks
Created June 1, 2013 17:09
Show Gist options
  • Save vaishaks/5691046 to your computer and use it in GitHub Desktop.
Save vaishaks/5691046 to your computer and use it in GitHub Desktop.
import fractions
T = input()
dim = []
for i in xrange(0, T):
dim.append(raw_input().split())
for i in dim:
sq = fractions.gcd(int(i[0]), int(i[1]))
print (int(i[0])*int(i[1]))/(sq*sq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment