POJ 3174 暴力枚举
思路:
暴力枚举三个点 判一判 搞定
(x1*y1=x2*y2) x1、y1、x2、y2为他们两两的差
//By SiriusRen
#include <cstdio>
using namespace std;
int n,cnt;
struct Point{int x,y;}point[888];
struct ans{int x,y,z;}ans[888];
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d%d",&point[i].x,&point[i].y);
for(int i=1;i<=n;i++)
for(int j=i+1;j<=n;j++)
for(int k=j+1;k<=n;k++)
if((point[i].x-point[j].x)*(point[j].y-point[k].y)==(point[j].x-point[k].x)*(point[i].y-point[j].y))
ans[++cnt].x=i,ans[cnt].y=j,ans[cnt].z=k;
printf("%d\n",cnt);
for(int i=1;i<=cnt;i++)
printf("%d %d %d\n",ans[i].x,ans[i].y,ans[i].z);
}
POJ 3174 暴力枚举的更多相关文章
- POJ - 1426 暴力枚举+同余模定理 [kuangbin带你飞]专题一
完全想不到啊,同余模定理没学过啊,想起上学期期末考试我问好多同学'≡'这个符号什么意思,都说不知道,你们不是上了离散可的吗?不过看了别人的解法我现在会了,同余模定理介绍及运用点这里点击打开链接 简单说 ...
- POJ 3080 Blue Jeans (字符串处理暴力枚举)
Blue Jeans Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 21078 Accepted: ...
- POJ 2739 Sum of Consecutive Prime Numbers( *【素数存表】+暴力枚举 )
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 19895 ...
- poj 1753 Flip Game(暴力枚举)
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 52279 Accepted: 22018 Des ...
- POJ-3187 Backward Digit Sums (暴力枚举)
http://poj.org/problem?id=3187 给定一个个数n和sum,让你求原始序列,如果有多个输出字典序最小的. 暴力枚举题,枚举生成的每一个全排列,符合即退出. dfs版: #in ...
- POJ 2182/暴力/BIT/线段树
POJ 2182 暴力 /* 题意: 一个带有权值[1,n]的序列,给出每个数的前面比该数小的数的个数,当然比一个数前面比第一个数小的个数是0,省略不写,求真正的序列.(拗口) 首先想到的是从前到后暴 ...
- CodeForces 742B Arpa’s obvious problem and Mehrdad’s terrible solution (暴力枚举)
题意:求定 n 个数,求有多少对数满足,ai^bi = x. 析:暴力枚举就行,n的复杂度. 代码如下: #pragma comment(linker, "/STACK:1024000000 ...
- 2014牡丹江网络赛ZOJPretty Poem(暴力枚举)
/* 将给定的一个字符串分解成ABABA 或者 ABABCAB的形式! 思路:暴力枚举A, B, C串! */ 1 #include<iostream> #include<cstri ...
- HNU 12886 Cracking the Safe(暴力枚举)
题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=12886&courseid=274 解题报告:输入4个数 ...
随机推荐
- array.fliter无法正确过滤出我想要的数组
var checked_list = state.files.filter(function(item, id){ // console.log('click the ' + item.id); re ...
- JavaScript中函数作为另一个函数的参数的时候它存在于哪个作用域
一直对函数作为参数被传递进另外一个函数理解的不是很清除.先看下这段代码吧: function test(fn){ var bar = 1; fn(); } var bar = 99; test(fun ...
- 栈 <stack> F - 宋飞正传
I’m out of stories. For years I’ve been writing stories, some rather silly, just to make simple prob ...
- bzoj 2259: [Oibh]新型计算机 最短路 建模
Code: #include<cstdio> #include<cstring> #include<algorithm> #include<queue> ...
- Html Input disabled属性
input的disabled: <input type="text" name="name" placeholder="请输入名称" ...
- P2420 让我们异或吧(树链剖分)
题目描述 异或是一种神奇的运算,大部分人把它总结成不进位加法. 在生活中-xor运算也很常见.比如,对于一个问题的回答,是为1,否为0.那么: (A是否是男生 )xor( B是否是男生)=A和B是否能 ...
- ECNUOJ 2856 仰望星空
仰望星空 Time Limit:1000MS Memory Limit:65536KBTotal Submit:373 Accepted:145 Description 我仰望星空, 它是那样辽阔而 ...
- LeetCode -- 最大连续乘积子序列
问题描写叙述: 给定数组,找出连续乘积最大值的子序列.比如 0,-1,-3.-2.则最大连续乘积为6= (-3) * (-2) 实现思路此题与最大连续和的子序列问题相似,也可通过找到递推公式然后用DP ...
- hibernate generator id
以下内容整理自网络 “assigned” 主键由外部程序负责生成,在 save() 之前指定一个. “hilo” 通过hi/lo 算法实现的主键生成机制,需要额外的数据库表或字段提供高位 ...
- 常用sql语句及案例
目录 1)基本 2)数学函数 3)rownum 4)分页 5)时间处理 6)字符函数 7)to_number 8)聚合函数 9)学生选课 10)图书馆借阅 基本 --新建表: create table ...