HDU 1108

来源:互联网 发布:mysql数据库视频 编辑:程序博客网 时间:2024/06/03 02:42

直接穷举判断即可

#include <stdio.h>int main(){    int a,b,g;    while(scanf("%d%d",&a,&b)!=EOF)    {        if(a<b)        {            for(g=b;g<999999;g++)            {                if(g%a==0&&g%b==0)                {                    printf("%d\n",g);                    break;                }            }        }        else        {            for(g=b;g<999999;g++)            {                if(g%a==0&&g%b==0)                {                    printf("%d\n",g);                    break;                }            }        }    }    return 0;}



3 0
原创粉丝点击