第十七屆中國計量大學程式設計競賽 I- Isolated Pointset

Aconacon發表於2020-09-28

第十七屆中國計量大學程式設計競賽 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;
}

相關文章