文章
47
粉丝
109
获赞
9
访问
31.7k
#include<stdio.h>
int gcd(int a, int b) {
if (b == 0)return a;
else return gcd(b, a % b);
}
int main() {
int n;
int s[105] = { 0 };
while (scanf("%d", &n) != EOF) {
int min = 1;
for (int i = 0; i < n; i++) {
scanf("%d", &s[i]);
}
for (int i = 0; i < n; i++) {
min = min*s[i] /gcd(min, s[i]);
}
printf("%d\n", min);
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发