HDU-1019 Least Common Multiple

Least Common Multiple添加链接描述

#include <stdio.h>
int gcd(int a,int b);
int main()
{
    int n;
    scanf("%d",&n);
    int i;
    int n1,j,x,y;
    for (i=1;i<=n;i++){
        scanf("%d %d",&n1,&x);
        for (j=1;j<n1;j++){
            scanf("%d",&y);
            x=gcd(x,y);
        }
        printf("%d\n",x);
    }
    return 0;
 } 
 int gcd(int a,int b)
 {
     int c;
     c=a;
     while (a%b!=0){
         a=a+c;
     }
     return a;
 }
上一篇:storm是如何保证at least once语义的?


下一篇:MySQL greatest()和least()函数与MAX()和MIN()函数