A链接:https://www.nowcoder.com/acm/contest/163/A

Fruit Ninja is a juicy action game enjoyed by millions of players around the world, with squishy,
splat and satisfying fruit carnage! Become the ultimate bringer of sweet, tasty destruction with every slash.
Fruit Ninja is a very popular game on cell phones where people can enjoy cutting the fruit by touching the screen.
In this problem, the screen is rectangular, and all the fruits can be considered as a point. A touch is a straight line cutting
thought the whole screen, all the fruits in the line will be cut.
A touch is EXCELLENT if ≥ x, (N is total number of fruits in the screen, M is the number of fruits that cut by the touch, x is a real number.)
Now you are given N fruits position in the screen, you want to know if exist a EXCELLENT touch.

输入描述:

The first line of the input is T(1≤ T ≤ 100), which stands for the number of test cases you need to solve.
................
............................................................复制的有毒

输出描述:

For each test case, output "Yes" if there are at least one EXCELLENT touch. Otherwise, output "No".

输入

2
5 0.6
-1 -1
20 1
1 20
5 5
9 9
5 0.5
-1 -1
20 1
1 20
2 5
9 9

输出

Yes
No 题意:求一条直线,至少经过 N 个点中的 N * k 个点 解析 我感觉是随机写,题解也是, 那就随机吧。。。。 https://acm.ecnu.edu.cn/wiki/index.php?title=2018_ACM-ICPC_China_Shanghai_Metropolitan_Invitational_Contest

AC代码

#include <bits/stdc++.h>
#define LL long long
#define PI 3.1415926535897932384626
#define maxn 10050
#define EXIT exit(0);
#define DEBUG puts("Here is a BUG");
#define CLEAR(name, init) memset(name, init, sizeof(name))
const double eps = 1e-;
const int MAXN = 1e9 + ;
using namespace std;
#define Vector Point
int dcmp(double x)
{
return fabs(x) < eps ? : (x < ? - : );
}
struct Point
{
double x, y; Point(const Point& rhs): x(rhs.x), y(rhs.y) { } //拷贝构造函数
Point(double x = 0.0, double y = 0.0): x(x), y(y) { } //构造函数 friend istream& operator >> (istream& in, Point& P)
{
return in >> P.x >> P.y;
}
friend ostream& operator << (ostream& out, const Point& P)
{
return out << P.x << ' ' << P.y;
}
friend Vector operator + (const Vector& A, const Vector& B)
{
return Vector(A.x+B.x, A.y+B.y);
}
friend Vector operator - (const Point& A, const Point& B)
{
return Vector(A.x-B.x, A.y-B.y);
}
friend Vector operator * (const Vector& A, const double& p)
{
return Vector(A.x*p, A.y*p);
}
friend Vector operator / (const Vector& A, const double& p)
{
return Vector(A.x/p, A.y/p);
}
friend bool operator == (const Point& A, const Point& B)
{
return dcmp(A.x-B.x) == && dcmp(A.y-B.y) == ;
}
friend bool operator < (const Point& A, const Point& B)
{
return A.x < B.x || (A.x == B.x && A.y < B.y);
}
void in(void)
{
scanf("%lf%lf", &x, &y);
}
void out(void)
{
printf("%lf %lf", x, y);
}
};
template <class T> T sqr(T x)
{
return x * x;
}
double Dot(const Vector& A, const Vector& B)
{
return A.x*B.x + A.y*B.y; //点积
}
double Length(const Vector& A)
{
return sqrt(Dot(A, A));
}
double Angle(const Vector& A, const Vector& B)
{
return acos(Dot(A, B)/Length(A)/Length(B)); //向量夹角
}
double Cross(const Vector& A, const Vector& B)
{
return A.x*B.y - A.y*B.x; //叉积
}
double Area(const Point& A, const Point& B, const Point& C)
{
return fabs(Cross(B-A, C-A));
}
Vector normal(Vector x)
{
return Point(-x.y, x.x) / Length(x);
}
double angle(Vector x)
{
return atan2(x.y, x.x);
}
Point p[maxn];
int main()
{
int t,n;
double m; cin>>t;
while(t--)
{
cin>>n>>m;
for(int i=;i<=n;i++)
p[i].in();
int cnt=,ans,flag=;
while(cnt--)
{
int a=rand()%n+,b=rand()%n+;
if(a==b)continue;
ans=;
for(int i=;i<=n;i++)
{
if(fabs(Cross(p[i]-p[a],p[b]-p[a])-)<eps)
ans++;
}
if(ans*>=n*m*)
{
flag=;break;
}
}
if(flag==)
printf("No\n");
else
printf("Yes\n");
}
}

D链接:https://www.nowcoder.com/acm/contest/163/D

In order to become a magical girl, Thinking-Bear are learning magic circle.
He first drew a regular polygon of N sides, and the length of each side is a.
He want to get a regular polygon of N sides, and the polygon area is no more than L.
He doesn't want to draw a new regular polygon as it takes too much effort.
So he think a good idea, connect the midpoint of each edge and get a new regular polygon of N sides.
How many operations does it need to get the polygon he want?

输入描述:

The first line of the input is T(1≤ T ≤ 100), which stands for the number of test cases you need to solve.
The first line of each case contains three space-separated integers N, a and L (3 ≤ N ≤ 10, 1 ≤ a ≤ 100, 1 ≤ L ≤ 1000).

输出描述:

For each test case, output a single integer.

输入例子:
1
4 2 3
输出例子:
1

-->

示例1

输入

1
4 2 3

输出

1

题意 正n多边形,边长为a,每次都取边的中点为新的顶点,连成多边形,直到多边形面积不大于L

解析 正n多边形的面积 很容易求得, 新的多边形还是正n多边形,只不过边长变为了 a*sqrt(1-cos(内角)/2)<余弦定理得>

AC代码
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define fillchar(a, x) memset(a, x, sizeof(a))
#define huan printf("\n");
#define debug(a,b) cout<<a<<" "<<b<<" "<<endl;
#define PI 3.1415926535897932384626
using namespace std;
typedef long long ll;
const int maxn=1e7+,inf=1e18;
const ll mod=1e9+;
const double eps = 1e-;
double normalpolygonarea(int n,double a)
{
double h=(a/)/tan(PI/n);
double triangle=a*h/;
return triangle*n;
}
int main()
{
int n,m,t;
double a;
cin>>t;
while(t--)
{
cin>>n>>a>>m;
int ans=;
double angle=(n-)*PI/n;
while((normalpolygonarea(n,a)-m)>eps)
{
a=sqrt((-cos(angle))/)*a;
ans++;
}
cout<<ans<<endl;
}
}

2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 A,D的更多相关文章

  1. 2018 ACM 国际大学生程序设计竞赛上海大都会部分题解

    题目链接 2018 ACM 国际大学生程序设计竞赛上海大都会 下午午休起床被同学叫去打比赛233 然后已经过了2.5h了 先挑过得多的做了 .... A题 rand x*n 次点,每次judge一个点 ...

  2. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it

    链接:https://www.nowcoder.com/acm/contest/163/F 来源:牛客网 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it 时间限制:C ...

  3. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it (扫描线)

    2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it (扫描线) 链接:https://ac.nowcoder.com/acm/contest/163/F来源:牛客网 时间 ...

  4. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 J Beautiful Numbers (数位DP)

    2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 J Beautiful Numbers (数位DP) 链接:https://ac.nowcoder.com/acm/contest/163/ ...

  5. 2018 ACM 国际大学生程序设计竞赛上海大都会赛

    传送门:2018 ACM 国际大学生程序设计竞赛上海大都会赛 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛2018-08-05 12:00:00 至 2018-08-05 17:00:0 ...

  6. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 J Beautiful Numbers (数位dp)

    题目链接:https://ac.nowcoder.com/acm/contest/163/J 题目大意:给定一个数N,求区间[1,N]中满足可以整除它各个数位之和的数的个数.(1 ≤ N ≤ 1012 ...

  7. 2018 ACM 国际大学生程序设计竞赛上海大都会 F - Color it (扫描线)

    题意:一个N*M的矩形,每个点初始都是白色的,有Q次操作,每次操作将以(x,y)为圆心,r为半径的区域涂成黑点.求最后剩余白色点数. 分析:对每行,将Q次操作在该行的涂色视作一段区间,那么该行最后的白 ...

  8. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛-B-Perfect Numbers(完数)

    题目描述 We consider a positive integer perfect, if and only if it is equal to the sum of its positive d ...

  9. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛-K-Matrix Multiplication(矩阵乘法)

    题目描述 In mathematics, matrix multiplication or matrix product is a binary operation that produces a m ...

随机推荐

  1. CCF|中间数|Java

    import java.util.*; public class tyt { public static void main(String[] args) { Scanner in = new Sca ...

  2. ARM 环境下使用azure powershell 从远程blob中拉去vhd 并创建虚拟机

    最近需要从指定公共访问的blob中复制vhd到自己的订阅存储账户,并使用vhd创建AZURE ARM虚拟机(非经典版),而且在portal.azure.cn中无法实现虚拟机映像创建等功能,于是自己使用 ...

  3. swift的static和class修饰符---What is the difference between static func and class func in Swift?

    Special Kinds of Methods Methods associated with a type rather than an instance of a type must be ma ...

  4. 浅析HashSet add() 方法存储自定义类型对象的过程

    一.自定义一个Student类 package date0504; public class Student { private String id; Student(String id){ this ...

  5. json-server && axios

    json-server && axios vue2.0项目实战(3)使用axios发送请求 https://www.cnblogs.com/zhouyangla/p/6753673.h ...

  6. Spring自动注入的几种方式

    ---恢复内容开始---   @Service("accountEmailService")public class AccountEmailServiceImpl impleme ...

  7. JavaEE-05 分页与文件上传

    学习要点 新闻分页显示数据 新闻图片上传 JSP分页显示数据 分页 数据信息较多的的时候一般采用列表显示,方便展示信息: 数据量较大的时候一般采用列表加分页的方式显示,便于阅读. 分页方式:集合或者s ...

  8. win10 配置系统默认utf-8编码

    win10 配置系统默认utf-8编码 系统  win10 配置系统默认utf-8编码 Windows系统默认字符编码为gbk编码,开发项目编码一般为UTF-8,在我们执行程序及进行程序编码过程中编码 ...

  9. 通过洛谷P2639看01背包

    题目描述 Bessie像她的诸多姊妹一样,因为从Farmer John的草地吃了太多美味的草而长出了太多的赘肉.所以FJ将她置于一个及其严格的节食计划之中.她每天不能吃多过H ( <= H &l ...

  10. 天梯赛L1 题解

    L1-001 Hello World (5 分) 这道超级简单的题目没有任何输入. 你只需要在一行中输出著名短句“Hello World!”就可以了. AC代码:(直接输出记性) #include & ...