当前位置: 代码迷 >> 综合 >> 第十七届中国计量大学程序设计竞赛 I- Isolated Pointset
  详细解决方案

第十七届中国计量大学程序设计竞赛 I- Isolated Pointset

热度:65   发布时间:2024-02-23 16:51:31.0

第十七届中国计量大学程序设计竞赛 I- Isolated Pointset(签到题)
链接:https://ac.nowcoder.com/acm/contest/7591/I
来源:牛客网

On a two-dimensional plane, YHH has a series of isolated points named PointSet, which contains N points in it. YHH would like to know if there is a way to draw a vertical bisector from any two points in the PointSet, passing through at least one point in the PointSet. Please help him.
输入描述:
There are multiple test cases. The first line contains an integer T (1 ≤ T ≤ 2 × 10^5 ), indicating the number of test cases. For each test case:

Then followed T lines, each line contains an integer N (1 ≤ N ≤ 2 × 10^5 ), indicating the number of points in the PointSet.
输出描述:
If there is a way to solve this problem, output “Yes”(without quotes), otherwise, output “No”(without quotes) instead.

输入

2
4
5

输出

Yes
Yes

思路
这题其实乍一看没头绪,其实画几个图你会发现3点共圆。那么大于3都可以变成圆。圆是可以被平分的。所以大于等于3就可以了。
代码

#include<iostream>
using namespace std;
int main(){
    int n;cin>>n;while(n--){
    int a;cin>>a;if(a>=3)cout<<"Yes"<<endl;else if(a<3)cout<<"No"<<endl;}return 0;
}
  相关解决方案