We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
main = do
n <- getLine
str1 <- getLine
m <- getLine
str2 <- getLine
let x = show $ process str1 str2
putStrLn x
process ab cd = compute (product words ab) (product words cd)
compute a b = mod (gcd1 a b) 1000000007
allDivisors n = [x | x <- [1..n] , mod n x == 0]
gcd1 a 0 = a
gcd1 0 b = b
gcd1 a b = maximum $ map maximum [[x,y] | x <- allDivisors a, y <- allDivisors b , x==y ]
whats wrong with my code
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Huge GCD
You are viewing a single comment's thread. Return to all comments →
whats wrong with my code