算法训练——斜率计算
//斜率计算 #include<stdio.h> int main(){ int x1,x2,y1,y2,k; scanf("%d%d\n%d%d",&x1,&y1,&x2,&y2); if(x2-x1 == 0) printf("INF"); else{ k = (y2-y1)/(x2-x1); printf("%d",k); } return 0; }
//斜率计算 #include<stdio.h> int main(){ int x1,x2,y1,y2,k; scanf("%d%d\n%d%d",&x1,&y1,&x2,&y2); if(x2-x1 == 0) printf("INF"); else{ k = (y2-y1)/(x2-x1); printf("%d",k); } return 0; }