【枚举】Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) Div2C题

题目大意:

平面上有N个点(N<=1000),定义一个点为好,当且仅当,由这个点为三角形的顶点,组成的所有三角形,两边的夹角都为钝角,称为好点,求好点的数目。

题目分析:

首先考虑朴素的枚举,枚举三元组<i,j,k>,以i为顶点,j , k 为两边 ,查看是否i为顶点的所有三角形,都以i所在顶点为钝角。

考虑优化:

三角形内角和是180

如果<i, j, k> 是以i为顶点的钝角/直角三角形,则 j, k 是坏点,不需要枚举。

如果<i, j, k> 是锐角,i为坏点。

时间: 2024-08-25 09:20:39

【枚举】Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) Div2C题的相关文章

D. Arpa and a list of numbers Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017)

http://codeforces.com/contest/851/problem/D 分区间操作 1 #include <cstdio> 2 #include <cstdlib> 3 #include <cmath> 4 #include <cstring> 5 #include <time.h> 6 #include <string> 7 #include <set> 8 #include <map> 9

Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) A

Arpa is researching the Mexican wave. There are n spectators in the stadium, labeled from 1 to n. They start the Mexican wave at time 0. At time 1, the first spectator stands. At time 2, the second spectator stands. ... At time k, the k-th spectator

Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) D

Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1. Arpa can perform two types of operations: Choose a number and delete it with

Codeforces Round #500 (Div. 2) [based on EJOI]

Codeforces Round #500 (Div. 2) [based on EJOI] https://codeforces.com/contest/1013 A 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define lson l,mid,rt<<1 4 #define rson mid+1,r,rt<<1|1 5 #define IT set<node>::iterator 6 #def

[Codeforces Round #522 (Div. 2, based on Technocup 2019 Elimination Round 3)][C. Playing Piano]

http://codeforces.com/contest/1079/problem/C 题目大意:给出一个数列a[n],让构造一个满足下列条件的数列b[n]:如果a[i]>a[i-1]那么b[i]>b[i-1],如果a[i]<a[i-1]那么b[i]<b[i-1],如果a[i]==a[i-1],那么b[i]!=b[i-1].其中1<=b[i]<=5  1<=a[i]<=2*1e5. 题解:dp[i][j]表示在位置i处取j时是否成立,如果成立则dp[i][

Codeforces Round #623 (Div. 2, based on VK Cup 2019-2020 - Elimination Round, Engine)

题目链接:https://codeforces.com/contest/1315 A - Dead Pixel 诚心诚意的送分题. 题意:给一个n*m的格子矩阵,和一个坏掉的格子,找一个最大的不包含坏掉的格子的矩阵. void test_case() { int n, m, x, y; scanf("%d%d%d%d", &n, &m, &x, &y); int ans = max(x * m, (n - (x + 1)) * m); ans = max

Codeforces Round #432 (Div. 2) D. Arpa and a list of numbers(暴力)

枚举质数,判断是否超过临界值.临界值就是将不是因子中不含这个素数的数的个数乘以x和y的较小值,是否小于当前最小值. #include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #define Max 1000001 #define MAXN 500005 #define MAXNUM 1000005 #define MOD 100000000 #define ri

Codeforces Round #437 (Div. 2, based on MemSQL Start[c]UP 3.0 - Round 2) E. Buy Low Sell High [贪心 II][数据结构 I]

题目:http://codeforces.com/contest/867/problem/E 题意:模拟股票操作,每天只能买一只股票或者卖一只股票或者什么也不做,求最大利润. 题解:仔细想想是非常简单的一个贪心问题,理解为连续的多次贪心买入卖出可以合并为一次的买入卖出,且值为最优.只需要用一个最小堆每次寻找前面的最小且没有被标记为购买点的值即可.如果自己为最小值,continue.如果那个值没有被选过,为买入点,pop.如果那个值被选为了售出的点,那么取消售出的标记,把当前点标记为售出点,利润直

Codeforces Round #512 (Div. 2, based on Technocup 2019 Elimination Round 1) C. Vasya and Golden Ticket

C. Vasya and Golden Ticket time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Vasya found a golden ticket - a sequence which consists of nn digits a1a2-ana1a2-an. Vasya considers a ti