ACM: FZU 2110 Star - 数学几何 - 水题
Description
Input
The first line of the input contains an integer T (T≤10), indicating the number of test cases.
For each test case:
The first line contains one integer n (1≤n≤100), the number of stars.
The next n lines each contains two integers x and y (0≤|x|, |y|≤1,000,000) indicate the points, all the points are distinct.
Output
Sample Input
1
3
0 0
10 0
5 1000
Sample Output
1 求锐角三角形的个数; 数学结论 : 锐角三角形 任意边满足 a^2<b^2+c^2 ; AC代码:
#include"algorithm"
#include"iostream"
#include"cstring"
#include"cstdlib"
#include"cstdio"
#include"string"
#include"vector"
#include"stack"
#include"queue"
#include"cmath"
#include"map"
using namespace std;
typedef long long LL ;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define FK(x) cout<<"["<<x<<"]\n"
#define memset(x,y) memset(x,y,sizeof(x))
#define memcpy(x,y) memcpy(x,y,sizeof(x))
#define bigfor(T) for(int qq=1;qq<= T ;qq++) struct Star {
LL x;
LL y;
} st[200]; bool cmp(LL a,LL b) {
return a>b;
} bool check(int i,int j,int k) {
LL s[3];
s[0]=(st[i].x-st[j].x)*(st[i].x-st[j].x)+(st[i].y-st[j].y)*(st[i].y-st[j].y);
s[1]=(st[i].x-st[k].x)*(st[i].x-st[k].x)+(st[i].y-st[k].y)*(st[i].y-st[k].y);
s[2]=(st[k].x-st[j].x)*(st[k].x-st[j].x)+(st[k].y-st[j].y)*(st[k].y-st[j].y);
// FK(s[0]);
// FK(s[1]);
// FK(s[2]);
sort(s,s+3,cmp);
if(s[0]<s[1]+s[2])return 1;
return 0;
} int main() {
int T;
int n;
scanf("%d",&T);
bigfor(T) {
scanf("%d",&n);
for(int i=0; i<n; i++) {
scanf("%I64d%I64d",&st[i].x,&st[i].y);
}
LL ans=0;
for(int i=0; i<n; i++) {
for(int j=i+1; j<n; j++) {
for(int k=j+1; k<n; k++) {
if(check(i,j,k)) ans++;
}
}
}
printf("%I64d\n",ans);
}
return 0;
}
ACM: FZU 2110 Star - 数学几何 - 水题的更多相关文章
- nyoj--1011--So Easy[II](数学几何水题)
So Easy[II] 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 这是一道基础的计算几何问题(其实这不提示大家也都看的出).问题描述如下: 给你一个N边形.且N边形 ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- HDU 2674 N!Again(数学思维水题)
题目 //行开始看被吓一跳,那么大,没有头绪, //看了解题报告,发现这是一道大大大的水题,,,,,//2009 = 7 * 7 * 41//对2009分解,看它有哪些质因子,它最大的质因子是41,那 ...
- HDU ACM 1073 Online Judge ->字符串水题
分析:水题. #include<iostream> using namespace std; #define N 5050 char a[N],b[N],tmp[N]; void Read ...
- UVa 12230 && HDU 3232 Crossing Rivers (数学期望水题)
题意:你要从A到B去上班,然而这中间有n条河,距离为d.给定这n条河离A的距离p,长度L,和船的移动速度v,求从A到B的时间的数学期望. 并且假设出门前每条船的位置是随机的,如果不是在端点,方向也是不 ...
- ACM: FZU 2102 Solve equation - 手速题
FZU 2102 Solve equation Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & ...
- ACM: POJ 1401 Factorial-数论专题-水题
POJ 1401 Factorial Time Limit:1500MS Memory Limit:65536KB 64bit IO Format:%lld & %llu ...
- FZU 2110 Star
简单暴力题,读入%lld会WA,%I64d能过. #include<cstdio> #include<cstring> #include<cmath> #inclu ...
- C 几何水题 求不同斜率的数目 枚举+set
Description Master LU 非常喜欢数学,现在有个问题:在二维空间上一共有n个点,LU每连接两个点,就会确定一条直线,对应有一个斜率.现在LU把平面内所有点中任意两点连线,得到的斜率放 ...
随机推荐
- 三、Shell变量类型和运算符
一.Shell变量的应用 1.Shell变量的种类 ·用户自定义变量:由用户自己定义.修改和使用 ·预定义变量:Bash预定义的特殊变量,不能直接修改 ·位置变量:通过命令行给 ...
- C# 异步
private void GetHttpResponse() { var client = new Microsoft.HBase.Client.HBaseClient(new ClusterCred ...
- 使用Spring和SpringMVC管理bean时要注意的一个小细节
最近一直在做毕业设计...用到了Shiro和SpringMVC..用过shiro的朋友都知道shiro需要自己去写Realm,然后把Realm注入到SecurityManager中.而Security ...
- 【PHP开发篇】一个统计客户端商机提交的获取IP地址
1.对客服提交数据的ip地址记录. 获取ip地址的方法: public function getIP() { global $ip; if (getenv("HTTP_X_REAL_IP&q ...
- Android通过名称找图片
开发中往往会遇到这种情况:在Drawable文件夹中有若干张相似的图片(这里的相似指的是不仅图片名称相似,用途也相似),现在要根据用户的某个操作选出其中的一张.例如,在类似微信语音功能的开发中,按住“ ...
- HDU 1003 maxsum
#include<iostream> #include<vector> using namespace std; typedef struct { int maxsum; in ...
- 限制帐号同时两处以上登录-ASP.NET
///登录页面 Hashtable haol = (Hashtable)Application["olTable"]; if (haol == null) { haol = new ...
- C++文件读写详解
http://blog.csdn.net/kingstar158/article/details/6859379/
- nginx负载均衡基于ip_hash的session粘帖
nginx负载均衡基于ip_hash的session粘帖 nginx可以根据客户端IP进行负载均衡,在upstream里设置ip_hash,就可以针对同一个C类地址段中的客户端选择同一个后端服务器,除 ...
- GitHub for windows呆瓜级入门
一.GitHub是一个远程数据托管平台,对于代码用于版本控制(保存各个阶段的代码版本).首先去 https://github.com/ 注册一个GitHub账号 二.输入用户名(不能重复,相当于在Gi ...