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 恭介被关进了库特设计的密室.正当她们松了一口气时 ...
随机推荐
- (转)CentOS最大文件描述符限制更改
CentOS最大文件描述符限制更改 原文:https://www.cnblogs.com/TonyXiaoClub/p/4747736.html 系统级的限制:/proc/sys/fs/file-ma ...
- PHP面向对象编程一
php面向对象编程(一) 类与对象关系: 类就像一个人类的群体 我们从类中实例化一个对象 就像是制定一个人. 面向对象程序的单位就是对象,但对象又是通过类的实例化出来的,所以我们首先要做的就是如何 ...
- window.location获取url各项参数详解
window.location方法后还还可以带href,search等参数,下面我们来看看获取url各项参数的办法. URL即:统一资源定位符 (Uniform Resource Locator, U ...
- java反射-使用反射获取类的所有信息
在OOP(面向对象)语言中,最重要的一个概念就是:万事万物皆对象. 在java中,类也是一个对象,是java.lang.Class的实例对象,官网称该对象为类的类类型. Class 类的实例表示正在运 ...
- 2013 QConf上海软件开发大会总结
带着工作中的一些疑问,我参加了在上海举办的QConf 全球软件开发大会.会议以主题的形式按分会场召开,我主要选择知名网站案例分析.大数据处理技术.高效能团队建设和金融系统架构与设计四个主题内容.三天会 ...
- centos 安装 freeswitch,开启与关闭
---恢复内容开始--- 官网说明地址 :https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7 1.获取源码 ...
- php-7.1.11编译选项配置
./configure \ --prefix=/usr/local/php-7.1.11 \ --with-config-file-path=/usr/local/php7.1.11/etc \ -- ...
- tomcat jdk官网下载教程
Tomcat不同版本官网下载: 1.官网地址:http://tomcat.apache.org/ 2.点击要下载的版本进入下载页,点击Archives进入版本选择页,然后选择对应的版本文件夹,进去后点 ...
- linux中配置yum源
1.配置163或者阿里云yum源: 阿里云yum源地址:https://mirrors.aliyun.com/centos/6.9/os/x86_64/Packages/ 阿里云给出的解决办法:htt ...
- python语法之一
Python 标识符 在 Python 里,标识符由字母.数字.下划线组成. 在 Python 中,所有标识符可以包括英文.数字以及下划线(_),但不能以数字开头. Python 中的标识符是区分大小 ...