文章
47
粉丝
109
获赞
8
访问
28.4k
#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;
}
登录后发布评论
暂无评论,来抢沙发