Codeforces Round #432 B

Arpa and an exam about geometry

题意:a b c3个点在二维平面上构成一个三角形,问是否存在一个点,使得三角形绕点旋转一定角度后可以使得a到b,b到c的位置上

思路:易得,所求的点一定是abc三点共圆的圆心,且ab,bc所对的圆心角相等,即ab=bc,且abc不共线

AC代码:

#include "iostream"
#include "iomanip"
#include "string.h"
#include "time.h"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "set"
#include "map"
#include "algorithm"
#include "stdio.h"
#include "math.h"
#pragma comment(linker, "/STACK:102400000,102400000")
#define bug(x) cout<<x<<" "<<"UUUUU"<<endl;
#define mem(a,x) memset(a,x,sizeof(a))
#define step(x) fixed<< setprecision(x)<<
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define ll long long
#define endl ("\n")
#define ft first
#define sd second 1
#define lrt (rt<<1)
#define rrt (rt<<1|1)
using namespace std;
const ll mod=1e9+7;
const ll INF = 1e18+1LL;
const int inf = 1e9+1e8;
const double PI=acos(-1.0);
const int N=1e3+100;

int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    ll a1,a2,b1,b2,c1,c2;
    cin>>a1>>a2>>b1>>b2>>c1>>c2;
    ll ab=(b1-a1)*(b1-a1)+(b2-a2)*(b2-a2);
    ll bc=(c1-b1)*(c1-b1)+(c2-b2)*(c2-b2);
    if(ab!=bc){
        cout<<"No";
        return 0;
    }
    else{
        ll k1,k2;
        k1=(b2-a2)*(c1-b1);
        k2=(c2-b2)*(b1-a1);
        if(k1==k2) cout<<"No";
        else cout<<"Yes";
    }
    return 0;
}
时间: 2024-08-07 12:30:51

Codeforces Round #432 B的相关文章

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 A

A - Arpa and a research in Mexican wave 思路:模拟 AC代码: #include "iostream" #include "iomanip" #include "string.h" #include "time.h" #include "stack" #include "queue" #include "string" #inc

Codeforces Round #432 C

Five Dimensional Points 题意:在一个5维空间内,给出n个点的坐标,对于一个点来说,若存在2个点使得这个点的角度为锐角,那么这个点定义为坏点,否则为好点,求好点个数并按升序输出好点编号 思路:在一个二维平面内,若点数大于等于3,那么最多只有一个好点,因为一个点可以与任意其他2个点构成3角形,所以最多存在一个点的角度都大于等于90度,拓展到3维平面的时候,所有在第3维的点(即z不为0) (x,y,z)与原2维平面内的任意2个点构成的平面内都只有至多一个好点,推广到n维也是如此

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#432 简要题解

来自FallDream的博客,未经允许,请勿转载,谢谢. Div2A 小判断题 Div2B 小判断题,合法的条件是|AB|=|BC|且三点不共线 Div1A 类比二维.三维空间,可以猜测n太大的时候没有答案.这样n小的时候我们就暴力就行啦. Div1B 首先枚举gcd,然后每个数要么删除,要么向上补到第一个倍数.对个数做前缀和,然后枚举之前枚举的gcd的倍数,统计答案.细节比较多. Div1C 不同质因数分开做.把1次是否出现.2次是否出现....压成一个数,求sg函数时枚举所有转移.这样n<=

【枚举】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为

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

Educational Codeforces Round 21 G. Anthem of Berland(dp+kmp)

题目链接:Educational Codeforces Round 21 G. Anthem of Berland 题意: 给你两个字符串,第一个字符串包含问号,问号可以变成任意字符串. 问你第一个字符串最多包含多少个第二个字符串. 题解: 考虑dp[i][j],表示当前考虑到第一个串的第i位,已经匹配到第二个字符串的第j位. 这样的话复杂度为26*n*m*O(fail). fail可以用kmp进行预处理,将26个字母全部处理出来,这样复杂度就变成了26*n*m. 状态转移看代码(就是一个kmp