문제

#include <vector>
using namespace std;

int gcd(int a, int b) {
	int r;
	while (b) {
		r = a % b;
		a = b;
		b = r;
	}
	return a;
}

int lcm(int a, int b) {
	return (a * b / gcd(a, b));
}

int solution(vector<int> arr) {
	int answer = 0;
	int i;
	if (arr.size() == 1) return arr[0];
	answer = lcm(arr[0], arr[1]);
	for (i = 2; i < arr.size(); i++) answer = lcm(answer, arr[i]);
	return answer;
}