#include<bits/stdc++.h>
using namespace std;
typedef struct{
 double k,b;
}node;
node k[1000007];
bool cmp(node&a,node&b){
 if(a.k==b.k)
  return a.b<b.b;
 return a.k<b.k;
}
long long x[1007],y[1007];
int main(){
 long long n,ans=0,tot=0;
 scanf("%lld",&n);
 for(long long i=1;i<=n;++i)
  scanf("%lld%lld",&x[i],&y[i]);
 for(long long i=1;i<=n;++i){
  for(long long j=1;j<i;++j){
   if(x[i]!=x[j])
    k[++tot].k=(y[i]-y[j])*1.0/(x[i]-x[j]),k[tot].b=y[i]-x[i]*k[tot].k;
   else
    k[++tot].b=x[i],k[tot].k=1000000;
  }
 }
 sort(k+1,k+1+tot,cmp);
 long long i=1;
 for(long long i=tot;i>=1;--i)
  if(k[i].k==k[i-1].k&&k[i].b==k[i-1].b)
   k[i].k=10000000;
 sort(k+1,k+1+tot,cmp);
 for(long long i=1;i<=tot;++i)
  if(k[i].k==10000000){
   tot=i-1;
   break;
  }
 while(i<=tot){
  long long x=i;
  while(k[i].k==k[i+1].k)
   i++;
  ans+=(i-x+1)*(x-1);
  i++;
 }
 cout<<ans;
 return 0;
}

Codeforces Round #558 (Div. 2)C(计算几何,排列组合,模拟)的更多相关文章

  1. Codeforces Round #558 (Div. 2)B(SET,模拟)

    #include<bits/stdc++.h>using namespace std;int a[100007];int cnt[100007];int main(){    int n; ...

  2. Codeforces Round #558 (Div. 2)

    目录 Codeforces Round #558 (Div. 2) 题解 A Eating Soup B Cat Party C Power Transmission D Mysterious Cod ...

  3. Codeforces Round #367 (Div. 2) B. Interesting drink (模拟)

    Interesting drink 题目链接: http://codeforces.com/contest/706/problem/B Description Vasiliy likes to res ...

  4. CodeCraft-19 and Codeforces Round #537 (Div. 2) D 多重排列 + 反向01背包 + 离线处理

    https://codeforces.com/contest/1111/problem/D 多重排列 + 反向01背包 题意: 给你一个字符串(n<=1e5,n为偶数),有q个询问,每次询问两个 ...

  5. Codeforces Round #558 (Div. 2)-Cat Party (Hard Edition)-(前缀和 + 模拟)

    http://codeforces.com/problemset/problem/1163/B2 题意:有n天,每天有一个颜色,截取前x天,随便抽掉一天,使剩下的各个颜色出现的次数相等. 解题,也可以 ...

  6. Codeforces Round #357 (Div. 2) E 计算几何

    传说中做cf不补题等于没做 于是第一次补...这次的cf没有做出来DE D题的描述神奇 到现在也没有看懂 于是只补了E 每次div2都是hack前2~3题 终于打出一次hack后的三题了...希望以后 ...

  7. Codeforces Round 558(Div 2)题解

    这场比赛没有打,后来和同学们一起开了场镜像打…… B是SB题结果WA了5发…… C是SB题结果差5min调出……虽然中间有个老师讲题吃掉了1h D是比较神仙的题(2200),但是做出来了?算是比较超常 ...

  8. Codeforces Round #379 (Div. 2) D. Anton and Chess 模拟

    题目链接: http://codeforces.com/contest/734/problem/D D. Anton and Chess time limit per test4 secondsmem ...

  9. Codeforces Round #Pi (Div. 2) B. Berland National Library 模拟

    B. Berland National LibraryTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contes ...

随机推荐

  1. jquery中bind,live,delegate,on的区别

    这几种方法都是绑定事件用到的,但是他们之间有些差别 bind(type,[data],fn) 为每个匹配元素的特定事件绑定事件处理函数 例如: <ul> <a href=" ...

  2. QuickReport FastReport

    一.QuickReport1.安装Component->Install packages->X:/Program Files/Borland/Delphi7/Bin/dclqrt70.bp ...

  3. appium-环境搭建(三)

    appium步骤:基本环境1.由于操作手机端操作,需要模拟器或者真机 itools模拟器,真机2.appium操作app,需要知道操作的app是什么?需要知道这个app包名 1.问开发 2.利用adt ...

  4. NserviceBus过期处理

    NserviceBus不过期,修改注册表 HKEY_CURRENT_USER\Software\NServiceBus\3.3下的项TrailDate到2099-08-02

  5. docker 基本概念

    image 操作系统 应用 registeries image 的远程仓库 containers 类似一个目录,一个容器包含了 应用运行所需要的一切东西, 容器之间互相独立 image包换一系列的层, ...

  6. urllib,urlib2与httplib,urllib3

    urllib:编码参数离不开urllib,urllib.urlencode, urllib.urlopen(URL,[,data]) 支持POST,根据参数区分post或者get urllib2:发送 ...

  7. 制作spark镜像

    构建镜像 添加jdk引用(可以使用yum进行安装): 安装SSH 碰到一个问题,执行systemctl的时候发生了异常: Failed to get D-Bus connection 解决这个问题的方 ...

  8. 洛谷 P4525 & P4526 [模板] 自适应辛普森积分

    题目:https://www.luogu.org/problemnew/show/P4525 https://www.luogu.org/problemnew/show/P4526 学习辛普森积分:h ...

  9. ubantu在登录界面一致循环的问题

    1.进入非图形化界面:在登录界面同时按下ctrl+alt+f1(有的需要同时按下ctrl+alt+f1+fn) 2.:输入你的账户名回车     *注意;这里是帐户名,而不是密码 3.:输入你的密码回 ...

  10. netty支持的协议

    流经网络的数据总是具有相同的类型:字节.这些字节是如何流动的主要取决于我们所说的 网络传输--一个帮助我们抽象底层数据传输机制的概念.用户并不关心这些细节:他们只想确保他们的字节被可靠地发送和接收. ...