Back
Close

LCM and GCD Calculator

Statement
You are given n numbers, print their LCM (least common multiple) and GCD (Greatest Common Divisor)

Input description
First Line - n Second Line - n numbers

Output description
LCM <space> GCD

Constraints
1 < n < 1000

Game modes
Fastest, Shortest, Reverse

Test cases
Test 1 Test
Input
4 1 2 3 4
Output
12 1

Validator 1 Validator
Input
4 1 2 3 4
Output
12 1

Test 2 Test
Input
8 12 10 33 2 8 92 77 8
Output
212520 1

Validator 2 Validator
Input
8 12 10 33 2 8 92 77 8
Output
212520 1

Test 3 Test
Input
3 72 96 120
Output
1440 24

Validator 3 Validator
Input
3 72 96 120
Output
1440 24

Test 4 Test
Input
5 32 16 88 92 108
Output
218592 4

Validator 4 Validator
Input
5 32 16 88 92 108
Output
218592 4

Solution language

Solution

Stub generator input