mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
27767e72ab
2800-2899
19 lines
316 B
C++
19 lines
316 B
C++
#include<stdio.h>
|
|
#include<string.h>
|
|
int gcd(int a, int b)
|
|
{
|
|
return b == 0 ? a : gcd(b, a % b);
|
|
}
|
|
int main()
|
|
{
|
|
int n,m,c;
|
|
while(scanf("%d%d",&n,&m)!=EOF)
|
|
{
|
|
if(n==0&&m==0)break;
|
|
n+=2;m+=1;
|
|
c=gcd(n,m);
|
|
printf("%d %d\n",m/c,n/c);
|
|
}
|
|
return 0;
|
|
}
|