swustoj 1157: least common multiple of the number n

swustoj 1157: n number of the least common multiple
subject description
seeking the least common multiple of the number n.
I.e. multiple use Euclid Euclidean

代码如下
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int pan(int q,int h){int ji=h;

while(1){
	if(h==1)return ji;
	if(q%h==0){
		int tmp=ji/h;
	return tmp;
	}
	
	int tmp;
	tmp=q%h;
	q=h;
	h=tmp;
}
}

int n;
int main(){
cin>>n;multisets;queuedq;
int a[n];int j=1;
for(int i=0;i<n;i++){
cin>>a[i];
dq.push(a[i]);
}
j=dq.front();
dq.pop();
while(–n){

j*=pan(j,dq.front());dq.pop();
}

cout<<j<<"\n";

}

ps: do question must seriously examine the topic, this question is not seen multiple sets of input, wa a long time, mad at me! ! !

Released three original articles · won praise 0 · Views 27

Guess you like

Origin blog.csdn.net/hello__bug/article/details/105247118