中学的 又用上了。 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int x1,y1,x2,y2,x3,y3,x4,y4; 8 double k1,k2,k3,d1,d2; 9 double x,y;10 11 ...
转载
2014-07-24 20:13:00
33阅读
2评论
很水的TARJAN求强联通图的问题。#include #include #include #include using namespace std;const int N=10010;const int M=100010;int head[N],dfn[N],low[N],stack[N],st;s...
转载
2014-12-01 16:07:00
78阅读
2评论
基础题,直线间关系#include #include #include #define eps 1e-8#define zero(x) (((x)>0?(x):-(x)) eps;}//判两
转载
2013-07-28 20:27:00
81阅读
2评论
简单tarjan算法。tarjan算法其实就是先找出一个强连通分量树的根,然后就很容易就可以找到整个强连通分量, 关键是利用dfs树迷宫城堡Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4584Accepted Submission(s): 2002Problem Description为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(N<=10000)和M条通道(M<=100000),每个通道都是单向的,就是说
转载
2013-05-09 09:00:00
46阅读
基础计算几何View Code //zju1280#include <iostream>#include <cstdio>using namespace std;struct Point{ double x,y;};class Line{public: Point pointa,pointb,pointk; void makeline(Point pointa,Point pointb);};void Line::makeline(Point a,Point b){ pointa=a; pointb=b; pointk.x=pointa.x...
转载
2013-01-18 14:08:00
77阅读
2评论
题意:给出长度为n的序列,问选出任意区间的所有数字的异或值,最大最小各是多少。 题解:字典树经典问题,把前i个串的异或值都插入到字典树里,然后如果要找最大值,就把所有前缀去贪心出最大值,每次找和自己不一样的节点走,如果要找最小值,也是把所有前缀拿去贪心出最小值,每次找和自己当前位一样的节点,找最后一个分叉点,但要刨除自己。#include <cstdio>#include <cstring>#
原创
2023-06-29 00:12:19
5阅读
#include <cmath>#include <algorithm>#include <iostream>
原创
2022-11-23 10:04:44
34阅读
题目大意: 给定n组数据,每组2条直线,求直线关系,关系有如下 1.重合 2.平行 3.相交于一点 输入: 有n行,每行8个数,表示第一条直线的两点和第二条直线的两点 输出: 格式参照输出样例,对于相交,输出交点 Sample Input Sample Output
转载
2017-08-01 09:47:00
38阅读
2评论
直线求交,我的方法是叉积为0联立解方程。
转载
2017-01-11 11:08:00
28阅读
2评论
http://poj.org/problem?id=1269叉积真的是计算几何利器首先对于两条直线(p1 p2) (p3 p4) 若两直线共线 则p3-p1与p2-p1的叉积模为0且p4-p1与p2-p1的叉积模为0否则 用斜率判一下平行最后 如果相交求交点 设交点为p0 则p1-p0与p2-p0的叉积模为0 p3-p0与p4-p0的叉积模为0联立后可得a1*x+b1*y+c1=
原创
2022-06-16 00:00:30
40阅读
We all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are parallel, 2) inters
原创
2022-11-10 00:56:46
27阅读
Descriptionas we all know, ZhangYu(Octopus vulgaris) brother has a
原创
2022-11-10 08:09:14
61阅读
The Doors POJ - 1556 题意:给出两条直线上的两点求两直线的交点。 思路: 一般方程法
原创
2022-08-22 21:14:39
57阅读
POJ_1269
可以先用叉积判断两条直线是否共线或者平行,如果有交点再用解析几何的办法就交点即可。
#include<stdio.h>#include<string.h>#define zero 1e-8double x1, y1, x2, y2, x3, y3, x4, y4;double det(double x1, double y1, double x2
转载
2012-02-10 01:45:00
34阅读
2评论
BTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubm distinct points on a plane def
原创
2023-04-20 21:19:04
45阅读
Problem Description为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(NInput输入包含多组
原创
2022-11-10 00:00:30
63阅读
嘟嘟嘟 翻译:直线求交。 本人第一道计算几何题。已经体会到了计算几何的恶心之处…… 首先当然有联立解析式的做法,然而在咱竞赛中一般都用向量的求法。 然后刚开始我就因为怎么存向量和直线的事情折腾了好半天:刚开始开了一个向量类和一个直线类,但是发现这样封装过度了,就把直线类删了。但是单纯的开一个向量类又
原创
2021-05-29 19:18:41
110阅读
Default Intersecting Lines Description 求两条直线相交部分,给出的坐标的范围在 -1000 到 1000 之间且为整数. Input 第一行为数据组数 N≤10 接下来N行,每行为x1y1x2y2x3y3x4y4.表示第一条直线过 (x1,y1) 和 (x2,y2) ,第二
原创
2012-12-30 12:48:42
124阅读
一、内容Let's call a positive integer composite if it has at least one divisor other than 1and itself. For example: the following numbers are composite: 1024, 4, 6, 9;the following numbers are not compo...
原创
2021-08-27 14:29:53
464阅读
Intersecting Lines Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17149 Accepted: 7373 Description We all know that a pair of distinct poi
原创
2021-12-31 17:23:47
68阅读