日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【FZU - 2140 】Forever 0.5 (计算几何,构造)

發布時間:2023/12/10 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【FZU - 2140 】Forever 0.5 (计算几何,构造) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

題干:

Given an integer N, your task is to judge whether there exist N points in the plane such that satisfy the following conditions:

1. The distance between any two points is no greater than 1.0.

2. The distance between any point and the origin (0,0) is no greater than 1.0.

3. There are exactly N pairs of the points that their distance is exactly 1.0.

4. The area of the convex hull constituted by these N points is no less than 0.5.

5. The area of the convex hull constituted by these N points is no greater than 0.75.

Input

The first line of the date is an integer T, which is the number of the text cases.

Then T cases follow, each contains an integer N described above.

1 <= T <= 100, 1 <= N <= 100

Output

For each case, output “Yes” if this kind of set of points exists, then output N lines described these N points with its coordinate. Make true that each coordinate of your output should be a real number with AT MOST 6 digits after decimal point.

Your answer will be accepted if your absolute error for each number is no more than 10-4.

Otherwise just output “No”.

See the sample input and output for more details.

Sample Input

3 2 3 5

Sample Output

No No Yes 0.000000 0.525731 -0.500000 0.162460 -0.309017 -0.425325 0.309017 -0.425325 0.500000 0.162460

Hint

This problem is special judge.

題目大意:

給你一個數n,讓你找出n個點,滿足一下關系:

  • 任意兩點的距離不大于1.0
  • 所有點到原點的距離不大于1.0
  • 恰好有N對點的距離為1.0
  • 由這些點構成的n邊形的面積不小于0.5
  • 由這些點構成的n邊形的面積不大于0.75

解題報告:

? ? ? ? ? ?因為點可以重復嘛對吧所以干脆都輸出那同一個點好了。。。

AC代碼:

#include<cstdio> #include<cmath> #include<iostream> using namespace std; const int maxn = 35; int main() {int t,n;cin>>t;while(t--) {scanf("%d", &n);if (n <= 3) printf("No\n");else {printf("Yes\n");printf("0 0\n");printf("-0.5 %.6lf\n",sqrt(3.0) / 2);printf("0.5 %.6lf\n",sqrt(3.0) / 2);for (int i = 4; i <= n; i++) {printf("%.6lf %.6lf\n",0.0,1.0);}}}return 0; }

?

總結

以上是生活随笔為你收集整理的【FZU - 2140 】Forever 0.5 (计算几何,构造)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。