牛客情人节 (悸动的距离)

 

 

点击查看代码
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int ans=0;
	if(a>=0&&c<=0||c>=0&&a<=0) ans++; //x轴交点 
	if(b>=0&&d<=0||b>=0&&d<=0) ans++; //y轴交点 
	if(ans==2&&a*d==b*c) ans--; // 判断是否 两点重合与原点(0,0) 
	cout<<ans<<endl; 
posted @ 2023-02-14 21:17  xxj112  阅读(30)  评论(0)    收藏  举报