Codeforces Gym 100342C Problem C. Painting Cottages 暴力

时间:2021-07-29 06:00:09

Problem C. Painting Cottages
Time Limit: 20 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个点,能够连多少个不同的线段就好了,感觉是签到题……

数据范围才300

代码:

//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 200001
#define mod 10007
#define eps 1e-9
int Num;
char CH[];
//const int inf=0x7fffffff; //нчоч╢С
const int inf=0x3f3f3f3f; 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 x,int y)
{
return y==?x:gcd(y,x%y);
}
map< pair<int,int> ,int> H;
node a[maxn];
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&period; Painting Cottages 转化题意

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

  2. Codeforces Gym 100513I I&period; Sale in GameStore 暴力

    I. Sale in GameStore Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/p ...

  3. Codeforces Gym 100342E Problem E&period; Minima 暴力

    Problem E. MinimaTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/attac ...

  4. Codeforces Gym 100342J Problem J&period; Triatrip 求三元环的数量 bitset

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

  5. Codeforces Gym 100342J Problem J&period; Triatrip bitset 求三元环的数量

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

  6. Codeforces Gym 100342D Problem D&period; Dinner Problem Dp&plus;高精度

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

  7. Codeforces Gym 100803F There is No Alternative 暴力Kruskal

    There is No Alternative 题目连接: http://codeforces.com/gym/100803/attachments Description ICPC (Isles o ...

  8. Codeforces Gym 100500F Problem F&period; Door Lock 二分

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

  9. Codeforces Gym 100610 Problem A&period; Alien Communication Masterclass 构造

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

随机推荐

  1. oracle函数--trunc

    作用:截取 语法:trunc(date,[fmt])   TRUNC函数,ORA-01898 精度说明符过多 TRUNC(SYSDATE)即可默认当前日期(年月日),---写到这一步就好了 TRUNC ...

  2. js全局变量和局部变量

    <script> var i = 'yuanjianhang'; function myloveName() { alert(i); var i = 'guanxi'; } myloveN ...

  3. OpenCV入门(二)

    这次主要学习了下滤波,就当复习了图像处理的知识了:http://blog.csdn.net/poem_qianmo/article/details/22745559 代码实现比较简单,但关于通过滚动条 ...

  4. The Child and Sequence

    Codeforces Round #250 (Div. 1)D:http://codeforces.com/problemset/problem/438/D 题意:给你一个序列,然后有3种操作 1x ...

  5. &lbrack;POJ 2115&rcub; C Looooops 题解(扩展欧几里德)

    题目描述 对于C的for(i=A ; i!=B ;i +=C)循环语句,给出A,B,C和k(k表示变量是在k进制下的无符号整数),判断循环次数,不能终止输出"FOREVER". 输 ...

  6. python 之路初(一):pycharm 安装 和 环境配置 和 中文乱码问题

    从健身和学习中我一体会到坚持的力量.想写写东西的想法已经好久了,就是不知道怎么开始.最近生活开始给我各种攻击和磨练,我从声嘶力竭到沉默到默默坚持自己,改变自己并总结告诉自己:少说多看,看破不说破,宁愿 ...

  7. 有了Jenkins,为什么还需要一个独立的部署系统

    需不需要一个独立的部署系统是很多企业用户在构建持续交付流程中经常困惑的一个问题.也经常有用户会问我们,现在已经有Jenkins,它自身提供了丰富的部署插件(如WebSphere部署插件.Tomcat部 ...

  8. UITextView设置占位文字

    这里只介绍一种,这种方便扩展,可以占位文字颜色. 我们继承一个UITextView: #import <UIKit/UIKit.h> @interface MyTextView : UIT ...

  9. bzoj2276&colon; &lbrack;Poi2011&rsqb;Temperature(单调队列&sol;堆)

    这题有两种写法,而且是完全(几乎?)不一样的写法...并不是换了个方法来维护而已 单调队列O(N):用一个队列维护a[]的单调递减,对于每个i满足a[队头]<=b[i],然后就可以算出以每一位为 ...

  10. java在文件中输出换行符

    在字符串后面添加\r\n就可以了.   或者使用newline方法: FileOutputStream fos=new FileOutputStream("c:\\11.txt") ...