文章
34
粉丝
109
获赞
7
访问
19.3k
#include <stdio.h>
int gcd(int a, int b)
{
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int reverse(int a) // 翻转数字
{
int index = 0;
int all = 0;
while (a > 0)
{
all = all * 10 + a % 10;
a /= 10;
}
return all;
}
int main()
{
int a, b;
scanf("%d %d", &a, &b);
int m = reverse(a);
int n = reverse(b);
printf("%d", gcd(m, n));
}
登录后发布评论
暂无评论,来抢沙发