PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000058. Ngày hội chung của các chủng tộc (Eid)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Ngày hội chung của các chủng tộc (Eid)
Eid
Source: LightOJ
Version: Phuoc Hung OJ Extended
Problem Statement
On a planet, race i holds a feast once every x_i time units. All feast periods start from the same instant. A shared celebration happens whenever all races feast together. Find the positive time interval between consecutive shared celebrations. The result can exceed 64-bit integer range and must be printed without truncation.
Input
First line: n. Second line: n positive integers x_i.
Output
The exact positive integer time interval.
Subtasks
- Subtask 1 (20 points): , .
- Subtask 2 (30 points): , .
- Subtask 3 (50 points): , .
Examples
Input
5
3 4 6 7 19
Output
1596
Explanation
The least common multiple of 3, 4, 6, 7, and 19 is 1596.