输入两个点的坐标,即p1 = (x1, y1)和p2=(x2, y2),求过这两个点的直线的斜率。如果斜率为无穷大输出“INF”。
样例输入
1 2
2 4
样例输出
2
样例输入
1 2
1 4
样例输出
INF
样例输入
1 2
3 2
样例输出
0
#include<iostream>
#include<cmath>
using namespace std;
struct{
int x, y;
}p1, p2;
int main()
{
cin >> p1.x >> p1.y >> p2.x >> p2.y;
if(p2.x == p1.x)
cout << "INF" << endl;
else cout << (p2.y-p1.y)/(p2.x-p1.x) << endl;
return 0;
}