杭电acm2028 哪里错啦Problem Description求n个数的最小公倍数.Input输入包含多个测试实例,每个测试实例的开始是一个正整数n,然后是n个正整数.Output为每组测试数据输出它们的最小公倍数,每个测试

来源:学生作业学帮网 编辑:学帮网 时间:2024/04/29 14:02:19

杭电acm2028 哪里错啦
Problem Description
求n个数的最小公倍数.
Input
输入包含多个测试实例,每个测试实例的开始是一个正整数n,然后是n个正整数.
Output
为每组测试数据输出它们的最小公倍数,每个测试实例的输出占一行.你可以假设最后的输出是一个32位的整数.
Sample Input
2 4 6
3 2 5 7
Sample Output
12
70
Author
lcy
#include
long int divisor(long int m,long int n)
\x05{
\x05long int temp;
\x05\x05if(m

#include
#include
using namespace std;
int zhuan(int a,int b)
{
int c,d;
c=a;d=b;
while(a!=b)
{
if(a>b) a=a-b;
if(b>a) b=b-a;
}
return c/a*d;
}
int main()
{
int n,a,b,i;
cin>>n;
vectorv;
while(n--)
{
cin>>a;
for(i=0;i>b;
v.push_back(b);
}
b=v[0];
for(i=1;i