懒得写高精
python水过
<span style="font-family:Microsoft YaHei;font-size:14px;color:#330099;">a=(int)(input())
b=(int)(input())
while b!=0:
t=a
a=b
b=t%b
print a </span>
Stein 算法
只有减法和位移
<span style="font-family:Microsoft YaHei;font-size:14px;color:#330099;">a=(int)(input())
b=(int)(input())
c=0
while (a!=0 and b!=0):
x=a&1;y=b&1
if (x==0 and y==0):
a>>=1;b>>=1;c=c+1
elif (x==0):
a>>=1
elif (y==0):
b>>=1
elif (a>b):
a-=b
else:
b-=a;
while (c!=0):
a<<=1;c=c-1
print a
</span>