标签:int else 分类器 flag 线性 type dp out
1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4 struct DOT 5 { 6 int x, y; 7 int type;//A1,B0 8 }; 9 int main() 10 { 11 int dot, judge; 12 cin >> dot >> judge; 13 struct DOT* dp = new struct DOT[dot]; 14 for (int i = 0; i < dot; i++) 15 { 16 cin >> dp[i].x >> dp[i].y; 17 char tempc; 18 cin >> tempc; 19 if (tempc == 'A') 20 dp[i].type = 1; 21 else 22 dp[i].type = 0; 23 } 24 for (int i = 0; i < judge; i++) 25 { 26 int a, b, c; 27 bool out = true; 28 int flag = 0;//A: >0 29 cin >> a >> b >> c; 30 int t = a + dp[0].x * b + dp[0].y * c; 31 if (t == 0) 32 { 33 out = false; 34 } 35 else 36 { 37 if (dp[0].type == 1)//A 38 { 39 if (t > 0) 40 { 41 flag = 0; 42 } 43 else 44 { 45 flag = 1; 46 } 47 } 48 else 49 { 50 if (t > 0) 51 { 52 flag = 1; 53 } 54 else 55 { 56 flag = 0; 57 } 58 } 59 for (int j = 1; j < dot; j++) 60 { 61 t = a + dp[j].x * b + dp[j].y * c; 62 if (flag == 0) 63 { 64 if ((dp[j].type == 1 && t < 0) || (dp[j].type == 0 && t > 0)) 65 { 66 out = false; 67 break; 68 } 69 } 70 else 71 { 72 if ((dp[j].type == 1 && t > 0) || (dp[j].type == 0 && t < 0)) 73 { 74 out = false; 75 break; 76 } 77 } 78 } 79 if (out)cout << "Yes" << endl; 80 else cout << "No" << endl; 81 } 82 } 83 return 0; 84 }
标签:int,else,分类器,flag,线性,type,dp,out 来源: https://www.cnblogs.com/2020R/p/13738944.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。