#include <iostream>
#include <vector>
using namespace std;
#define ll long long
struct Node { ll x, y; };
vector<Node> ans;
int n;
int check(Node& node, Node& pre_node, Node& root) {
ll y3 = root.y, y2 = pre_node.y, y1 = node.y;
ll x3 = root.x, x2 = pre_node.x, x1 = node.x;
if (y3 * x2 - y3 * x1 + y2 * x1 < y2 * x3 - y1 * x3 + y1 * x2) return 0;
return 1;
}
void fun(Node& node, Node& pre_node) {
int flag = 0;
for (int i = ans.size() - 1; i >= 0; i--) {
if (check(node, pre_node, ans[i])) {
flag = 1;
break;
}
}
if (!flag) ans.push_back(pre_node);
pre_node = node;
return;
}
int main() {
cin >> n;
Node root, pre_node;
cin >> root.x >> root.y >> pre_node.x >> pre_node.y;
ans.push_back(root);
n -= 2;
while (n--) {
Node node;
cin >> node.x >> node.y;
fun(node, pre_node);
}
cout << ans.size() - 1;
return 0;
}
L3-009 长城
最新推荐文章于 2024-09-04 14:45:59 发布