南通公司建站模板_100个网络营销案例_app推广方案怎么写_最有吸引力的营销模式
2025/2/13 20:57:53
来源:https://blog.csdn.net/m0_67663419/article/details/142341805
浏览:
次
关键词:南通公司建站模板_100个网络营销案例_app推广方案怎么写_最有吸引力的营销模式
南通公司建站模板_100个网络营销案例_app推广方案怎么写_最有吸引力的营销模式
问题描述
试题编号: | 202006-1 |
试题名称: | 线性分类器 |
时间限制: | 1.0s |
内存限制: | 512.0MB |
问题描述: | ![](https://i-blog.csdnimg.cn/direct/dc7a8a82918e4d4e933f60179a231012.png) ![](https://i-blog.csdnimg.cn/direct/889389a4ce804940b89fc86ead45688a.png) ![](https://i-blog.csdnimg.cn/direct/f0f63ecc5cf641beba9e1b235d10c0e6.png) 题解: #include<bits/stdc++.h>using namespace std;
int n, m;struct Node {int x, y;char ch;
}node[1010];bool judge(int x0, int x1, int x2)
{char ch1 = 'c', ch2 = 'd';for (int i = 0; i < n; i++){int tmp = x0 + x1 * node[i].x + x2 * node[i].y;if (tmp == 0){return false;}if (tmp > 0){ch1 = node[i].ch;}else if (tmp < 0){ch2 = node[i].ch;}if (ch1 == ch2){return false;}}return true;
}int main()
{int x0, x1, x2;cin >> n >> m;for (int i = 0; i < n; i++){cin >> node[i].x >> node[i].y >> node[i].ch;}for (int i = 0; i < m; i++){cin >> x0 >> x1 >> x2;if (judge(x0, x1, x2)){cout << "Yes" << endl;}else{cout << "No" << endl;}}return 0;
} |