标签:.com can blank href col 计算几何 scan style i++
题意:给你2个点A和B,和n条直线(ax+by+c=0),给n个a,b,c,求A到B至少跨过多少条直线
题解:对于每条直线,看2个点是否在他同侧,异侧答案就+1
1 #include<bits/stdc++.h> 2 using namespace std; 3 double x1,x2,y11,y2,a,b,c,t1,t2; 4 int n,ans; 5 int main() 6 { 7 cin>>x1>>y11; 8 cin>>x2>>y2; 9 scanf("%d",&n); 10 for(int i=0;i<n;i++) 11 { 12 cin>>a>>b>>c; 13 t1=a*x1+b*y11+c; 14 t2=a*x2+b*y2+c; 15 if (t1*t2<0) ans++; 16 } 17 cout<<ans<<endl; 18 }
Codeforces Round #284 (Div. 1) A. Crazy Town 计算几何
标签:.com can blank href col 计算几何 scan style i++
原文地址:https://www.cnblogs.com/qywhy/p/9678397.html