JZOJ 3493. 【NOIP2013模拟联考13】三角形
3493. 【NOIP2013模拟联考13】三角形(triangle)
(File IO): input:triangle.in output:triangle.out
Description
Input
接下来n行,每行两个整数,表示点的坐标。
Output
Sample Input
5
0 0
1 1
1 -1
-1 -1
-1 1
Sample Output
8
Data Constraint
对于100%的数据,n<=3000,坐标的绝对值不超过10^4,保证没有重合的点。
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define N 3007
using namespace std;
int n, h[N], z[N], tot, cnt, c[N * ];
long long ans;
bool b[N];
double K[N]; int main()
{
// freopen("triangle.in", "r", stdin);
// freopen("triangle.out", "w", stdout);
scanf("%d", &n);
for (int i = ; i <= n; i++)
scanf("%d%d", &h[i], &z[i]);
ans = (n * (n - )) / ;
ans *= n - ;
ans /= ;
for (int i = ; i <= n - ; i++)
{
cnt = ;
tot = ;
for (int j = i + ; j <= n; j++)
if (h[i] == h[j]) tot++;
else K[++cnt] = (double)(z[i] - z[j]) / (double)(h[i] - h[j]);
sort(K + , K + cnt + );
ans -= (tot * (tot - )) / ;
tot = ;
for (int j = ; j <= cnt; j++)
{
if (K[j] == K[j - ]) tot++;
else tot = ;
ans -= tot - ;
}
}
printf("%lld", ans);
fclose(stdin);
fclose(stdout);
}
JZOJ 3493. 【NOIP2013模拟联考13】三角形的更多相关文章
- JZOJ【NOIP2013模拟联考14】隐藏指令
JZOJ[NOIP2013模拟联考14]隐藏指令 题目 Description 在d维欧几里得空间中,指令是一个长度为2N的串.串的每一个元素为d个正交基的方向及反方向之一.例如,d = 1时(数轴) ...
- JZOJ 3487. 【NOIP2013模拟联考11】剑与魔法(dragons)
3487. [NOIP2013模拟联考11]剑与魔法(dragons) (Standard IO) Time Limits: 1000 ms Memory Limits: 131072 KB De ...
- JZOJ 3470. 【NOIP2013模拟联考8】最短路(path)
470. [NOIP2013模拟联考8]最短路(path) (Standard IO) Time Limits: 1000 ms Memory Limits: 262144 KB Detailed ...
- JZOJ 3463. 【NOIP2013模拟联考5】军训
3463. [NOIP2013模拟联考5]军训(training) (Standard IO) Time Limits: 2000 ms Memory Limits: 262144 KB Deta ...
- JZOJ 3462. 【NOIP2013模拟联考5】休息(rest)
3462. [NOIP2013模拟联考5]休息(rest) (Standard IO) Time Limits: 1000 ms Memory Limits: 262144 KB Detailed ...
- JZOJ 3461. 【NOIP2013模拟联考5】小麦亩产一千八(kela)
3461. [NOIP2013模拟联考5]小麦亩产一千八(kela) (Standard IO) Time Limits: 1000 ms Memory Limits: 262144 KB Det ...
- 【NOIP2013模拟联考7】OSU
[NOIP2013模拟联考7]OSU 描述 Description osu 是一款群众喜闻乐见的休闲软件. 我们可以把osu的规则简化与改编成以下的样子: 一共有n次操作,每次操作只有成功与失败之分, ...
- [jzoj]3468.【NOIP2013模拟联考7】OSU!(osu)
Link https://jzoj.net/senior/#main/show/3468 Description osu 是一款群众喜闻乐见的休闲软件. 我们可以把osu的规则简化与改编成以下的样子: ...
- [jzoj]3456.【NOIP2013模拟联考3】恭介的法则(rule)
Link https://jzoj.net/senior/#main/show/3456 Description 终于,在众亲们的奋斗下,最终boss 恭介被关进了库特设计的密室.正当她们松了一口气时 ...
随机推荐
- Visual Studio 使用
目录结构 solution_dir Debug: 存放Debug版本信息的.exe Release: Release的.exe .sln: visual studio 项目文件 project_dir ...
- Java排序算法(二)
java排序算法(二) 二.改进排序算法 2.1希尔排序 定义:希尔排序(ShellSort)是插入排序的一种.也称缩小增量排序,是直接插入排序算法的一种更高效的改进版本.希尔排序是非稳定排序算法. ...
- prototype 以及 constructor 属性的理解
1 为什么 xx.constructor.prototype 可以访问到当前对象的原型. 'str'.constructor.prototype 'str'.constructor 指向当前 ...
- 动态页面技术----JSP技术
1995年java诞生,没有jsp,只有Servlet, Servlet开发:Servlet上嵌套html代码,非常繁琐. 1998年,出现jsp,方便写html代码,并且可以在html代码中嵌套ja ...
- c#基础 函数传值
随便新建个控制台程序做个演示! 1.最基础,最普通的传值方式: static void Main(string[] args) { ); Console.WriteLine("x:" ...
- Fiddler 抓包工具总结(转)
Fiddler 抓包工具总结 阅读目录 1. Fiddler 抓包简介 1). 字段说明 2). Statistics 请求的性能数据分析 3). Inspectors 查看数据内容 4). Au ...
- Django之model基础(增删改查)
一.ORM 映射关系 表名 <-------> 类名 字段 <-------> 属性 表记录 <------->类实例对象二.创建表(建立模型) 在创建表之前的准备 ...
- 从零开始的全栈工程师——js篇2.10(对象与构造函数)
对象与构造函数 一.js数据类型 基本数据类型:string undefined null boolean number 引用数据类型 Object array function 二 ...
- #include stdio.h(2)
#include <stdio.h> //mian函数是程序的入口 int main() { /* //函数:是按一定的格式对一段代码的封装 //专门用来实现一功能的代码合集,可以重复使用 ...
- echarts折线图相关
optionJKDLine = { title: { text: '告警数量趋势图', textStyle:{ //标题样式 fontStyle:'normal', fontFamily:'sans- ...