Problem C. Painting Cottages
Time Limit: 2 Sec

Memory Limit: 256 MB

题目连接

http://codeforces.com/gym/100342/attachments

Description

The new cottage settlement is organized near the capital of Flatland. The construction company that is building the settlement has decided to paint some cottages pink and others — light blue. However, they cannot decide which cottages must be painted which color. The director of the company claims that the painting is nice if there is at least one pink cottage, at least one light blue cottage, and it is possible to draw a straight line in such a way that pink cottages are at one side of the line, and light blue cottages are at the other side of the line (and no cottage is on the line itself). The main architect objects that there are several possible nice paintings.
Help them to find out how many different nice paintings are there

Input

The first line of the input file contains n — the number of the cottages (1 ≤ n ≤ 300). The following n lines contain the coordinates of the cottages — each line contains two integer numbers xi and yi (−104 ≤ xi , yi ≤ 104 ).

Output

Output one integer number — the number of different nice paintings of the cottages.

Sample Input

4
0 0
1 0
1 1
0 1

Sample Output

12

HINT

题意

给你n个坐标即点,求出有多少种划分方法

题解

q神说题意转化一下,就是这个n个点,能够连多少个不同的线段,

对于覆盖的线段不算在内,ORZ q神

代码:

 #include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
#include <typeinfo>
#include <map>
#include <stack>
typedef __int64 ll;
#define inf 1000000000000
using namespace std;
inline ll read()
{
ll x=,f=;
char ch=getchar();
while(ch<''||ch>'')
{
if(ch=='-')f=-;
ch=getchar();
}
while(ch>=''&&ch<='')
{
x=x*+ch-'';
ch=getchar();
}
return x*f;
} //************************************************************************************** struct node
{
double x,y;
};
int gcd(int a,int b)
{
if(b==) return a;
else return gcd(b,a%b);
}
map< pair<int ,int > ,int> H;
node a[];
int main()
{
freopen("cottages.in","r",stdin);
freopen("cottages.out","w",stdout);
int n=read();
for(int i=;i<n;i++)
cin>>a[i].x>>a[i].y;
int ans=;
for(int i=;i<n;i++)
{
H.clear();
for(int j=i+;j<n;j++)
{
int aa=a[i].x-a[j].x;
int bb=a[i].y-a[j].y;
int cc=gcd(aa,bb);
if(H[make_pair(aa/cc,bb/cc)]==)
{
ans++;
H[make_pair(aa/cc,bb/cc)]=;
}
}
}
cout<<ans*<<endl;
}

Codeforces Gym 100342C Problem C. Painting Cottages 转化题意的更多相关文章

  1. Codeforces Gym 100342C Problem C. Painting Cottages 暴力

    Problem C. Painting CottagesTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/1 ...

  2. Codeforces Gym 100342D Problem D. Dinner Problem Dp+高精度

    Problem D. Dinner ProblemTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/1003 ...

  3. Codeforces Gym 100342J Problem J. Triatrip 求三元环的数量 bitset

    Problem J. Triatrip Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/at ...

  4. Codeforces Gym 100500F Problem F. Door Lock 二分

    Problem F. Door LockTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/at ...

  5. Codeforces Gym 100610 Problem A. Alien Communication Masterclass 构造

    Problem A. Alien Communication Masterclass Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codefo ...

  6. Codeforces Gym 100610 Problem K. Kitchen Robot 状压DP

    Problem K. Kitchen Robot Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10061 ...

  7. Codeforces Gym 100610 Problem H. Horrible Truth 瞎搞

    Problem H. Horrible Truth Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/1006 ...

  8. Codeforces Gym 100610 Problem E. Explicit Formula 水题

    Problem E. Explicit Formula Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10 ...

  9. Codeforces Gym 100002 Problem F "Folding" 区间DP

    Problem F "Folding" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/ ...

随机推荐

  1. visual studio 2010 破解版 破解方法

    1.Microsoft Visual Studio 2010下载(均来自微软官网) 高级版(Premium) [建议下载]       http://download.microsoft.com/do ...

  2. java 打包过程及如何使用第三方jar包

    地址:http://wenku.baidu.com/view/44a1bbed81c758f5f61f6779.html或者 http://wenku.it168.com/d_000575231.sh ...

  3. 新浪微博客户端(22)-创建微博Cell

    DJStatusCell.h #import <UIKit/UIKit.h> @class DJStatusCellFrame; @interface DJStatusCell : UIT ...

  4. motto6

    当你发现自己不错的时候,要适当的给自己加点凉水,让自己知道自己离“不错”还很远.

  5. linux 查找php.ini 文件

    sudo find /* -name 'php.ini' /etc/php5/fpm/php.ini

  6. gvim设置成不备份文件

    打开gVim,进入“编辑”-“启动设定” 在“behave mswin”下行位置添加 set nobackup 语句 退出并保存配置文件 :wq

  7. jQuery.snowflake雪花飘落插件

    一.前言 前言:最近圣诞节来临,需要在页面上应用一个雪花飘落的效果,做之前产品经理给了我网络上的一个demo,地址是http://demo.lanrenzhijia.com/demo/1225/sd/ ...

  8. 记一个奇怪的python异常处理过程

    我的一个程序, 总是在退出时报异常, Exception TypeError: "'NoneType' object is not callable" in <functio ...

  9. 《深入PHP与jQuery开发》读书笔记——Chapter1

    由于去实习过后,发现真正的后台也要懂前端啊,感觉javascript不懂,但是之前用过jQuery感觉不错,很方便,省去了一些内部函数的实现. 看了这一本<深入PHP与jQuery开发>, ...

  10. cocos基础教程(13)使用Physicals代替Box2D和chipmunk

    1.   概述 游戏中模拟真实的世界是个比较麻烦的事情,通常这种事情都是交给物理引擎来做.首屈一指的是Box2D了,它几乎能模拟所有的物理效果.而chipmunk则是个更轻量的引擎,能够满足简单的物理 ...