report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
GCD and LCM - MarisaOJ: Marisa Online Judge

GCD and LCM

Time limit: 1000 ms
Memory limit: 256 MB
You are given 2 integers $a, b$. Calculate they Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM). - The GCD of two integers, which are not all zero, is the largest positive integer that divides each of the integers. - The LCM of two numbers is the smallest number that is a multiple of both of them. ### Input - The first line contains 2 integers $a, b$. ### Output - GCD and LCM of $a, b$. ### Constraints - $1 \le a, b \le 10^9$. ### Example Input: ``` 4 6 ``` Output: ``` 2 12 ```
Other problems (Level 0)
Sum of divisors
Equal pairs
GCD and LCM
3
String queries
Consecutive
Prison
Topic
Basic
Rating 800
Solution (0) Solution