delete pics to save space
This commit is contained in:
22
history_source/挑战程序设计竞赛/2.6.1.1.cpp
Normal file
22
history_source/挑战程序设计竞赛/2.6.1.1.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include<cstdio>
|
||||
inline int abs(int a)
|
||||
{return a<0?-a:a;}
|
||||
inline int gcd(int a,int b)
|
||||
{return b==0?a:gcd(b,a%b);}
|
||||
int x1,x2,y1,y2;
|
||||
void solve()
|
||||
{
|
||||
int x=abs(x1-x2),y=abs(y1-y2);
|
||||
if(x==0&&y==0) printf("%d\n");
|
||||
else printf("%d\n",gcd(x,y)-1);
|
||||
}
|
||||
void init()
|
||||
{
|
||||
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
|
||||
}
|
||||
int main()
|
||||
{
|
||||
init();
|
||||
solve();
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user