FZU 2140 Forever 0.5(将圆离散化)

时间:2023-03-09 15:27:08
FZU 2140 Forever 0.5(将圆离散化)

主要就是将圆离散化,剩下的都好办

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
#define add 0.005
double x[],y[];
int main()
{
int t,n;
scanf("%d",&t);
x[] = y[] = ;
x[] = ,y[] = ;
x[] = 0.5,y[] = sqrt(0.75);
x[] = 0.5,y[] = y[]-;
for(int i = ;i <= ;i++)
{
x[i] = 0.5 + (i-) * add;
y[i] = sqrt( - x[i]*x[i]);
}
while(t--)
{
scanf("%d",&n);
if(n <= )
{
puts("No");
continue;
}
puts("Yes");
for(int i = ;i < n;i++)
{
printf("%.6lf %.6lf\n",x[i],y[i]);
}
}
}