hdu2534

 1 #include<stdio.h>
 2 long long gcd(long long a,long long b)
 3 {
 4     if (b==0) return a;
 5     return(gcd(b,a%b));
 6 }
 7 int main()
 8 {
 9     long long m,n;
10     while (~scanf("%I64d%I64d",&m,&n)&&(m!=0&&n!=0))
11     {
12         if (gcd(m,n)!=1) printf("Inf\n");
13         else printf("%I64d\n",m*n-m-n);
14     }
15 }

http://acm.hdu.edu.cn/showproblem.php?pid=2534

posted on 2014-07-16 14:28  xiao_xin  阅读(73)  评论(0编辑  收藏  举报

导航