mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
34806a93cd
2500-2599
42 lines
671 B
C++
42 lines
671 B
C++
#include<iostream>
|
|
#include<cstdio>
|
|
#include<cstdlib>
|
|
#include<algorithm>
|
|
#include<cmath>
|
|
#include<queue>
|
|
#include<stack>
|
|
#include<map>
|
|
#include<set>
|
|
#include<iomanip>
|
|
#include<string>
|
|
#include<cstring>
|
|
using namespace std;
|
|
int Gcd(__int64 x,__int64 y)
|
|
{
|
|
if(y==0)
|
|
return x;
|
|
else
|
|
return Gcd(y,x%y);
|
|
}
|
|
int main()
|
|
{
|
|
__int64 x,y,t,m;
|
|
while(cin>>x>>y&&(x||y))
|
|
{
|
|
if(x<y)
|
|
{
|
|
t=x;
|
|
x=y;
|
|
y=t;
|
|
}
|
|
if(Gcd(x,y)==1)
|
|
{
|
|
m=x*y-(x+y);
|
|
cout<<m<<endl;
|
|
}
|
|
else
|
|
cout<<"Inf"<<endl;
|
|
}
|
|
return 0;
|
|
}
|