判断转弯

/*
思路:
通过斜率来比较 
*/

#include 
using namespace std;

int main(){
	double x1, y1;
	double x2, y2;
	double x3, y3;
	double k1, k2;
	
	cin >> x1 >> y1;
	cin >> x2 >> y2;
	cin >> x3 >> y3;
	
	k1 = (y2 - y1) / (x2 - x1);
	k2 = (y3 - y2) / (x3 - x2);
	
	if(k2 < k1){
		cout << "right";
	}
	if(k2 > k1){
		cout << "left";
	}
} 

你可能感兴趣的:(ACM)