码迷,mamicode.com
首页 >  
搜索关键字:algorithm    ( 11758个结果)
POJ 1410 (线段是否与多边形相交 + 点是否在多边形内)
题目:传送门 题意:有 n 个测试样例,每个样例,输入四个点,前两个点代表一条线段,后两个点代表正方形的两个对角端点。 #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #include < ...
分类:其他好文   时间:2020-02-29 00:51:23    阅读次数:47
bzoj3670 [Noi2014]动物园
zz:https://www.cnblogs.com/GXZlegend/p/6855581.html Sol: 先求出next,然后我们可以发现如果x和next[x](x>0)连一条边,那么就是一颗树,而所求的num是每个点的所有祖先节点中最后一个长度小于等于len[x]的点之前的祖先节点个数-1 ...
分类:其他好文   时间:2020-02-28 22:53:37    阅读次数:50
广度优先搜索(BFS)
一、问题: 输入: 6 70 1 1 1 0 0 10 0 1 0 0 0 00 0 0 0 1 0 00 0 0 1 1 1 01 1 1 0 1 0 01 1 1 1 0 0 0 输出: 4 代码: #include<iostream> #include<algorithm> #include< ...
分类:其他好文   时间:2020-02-28 18:41:39    阅读次数:69
POJ 2556 (判断线段相交 + 最短路)
题目: 传送门 题意:在一个左小角坐标为(0, 0),右上角坐标为(10, 10)的房间里,有 n 堵墙,每堵墙都有两个门。每堵墙的输入方式为 x, y1, y2, y3, y4,x 是墙的横坐标,第一个门的区间为[ (x, y1) ~ (x, y2) ],问你从 (0, 5) 走到 (10, 5) ...
分类:其他好文   时间:2020-02-28 17:21:15    阅读次数:50
hdu 1032 The 3n + 1 problem
题意:有一个数字,如果是奇数那么*3+1,如果是偶数/2,知道这个数字变成1.问n到m之间需要操作步数最多的数字操作了几步 解:模拟 #include <algorithm> #include <iostream> #include <cstring> #include <cstdio> #incl ...
分类:其他好文   时间:2020-02-28 17:20:25    阅读次数:47
【模板】凸包向内推进求不严格的半平面交——poj3384
想不明白这题写严格的半平面交为什么会错 /* 凸包所有边向内推进r */ #include<iostream> #include<cstring> #include<cstdio> #include<cmath> #include<vector> #include<algorithm> #inclu ...
分类:其他好文   时间:2020-02-28 16:04:09    阅读次数:69
二分+半平面交——poj1279
/* 二分距离,凸包所有边往左平移这个距离,半平面交后看是否还有核存在 */ #include<iostream> #include<cstring> #include<cstdio> #include<cmath> #include<vector> #include<algorithm> #inc ...
分类:其他好文   时间:2020-02-28 14:08:21    阅读次数:52
1000万的阶乘是多少?50行代码告诉你!
#include <algorithm> #include <iostream> #include <cstring> #include <cstdio> using namespace std; typedef long long ll; const double inf=1e20; const ...
分类:其他好文   时间:2020-02-28 13:58:17    阅读次数:39
半平面交求面积——poj1279
#include<iostream> #include<cstring> #include<cstdio> #include<cmath> #include<vector> #include<algorithm> #include<queue> using namespace std; #defin ...
分类:其他好文   时间:2020-02-28 11:42:20    阅读次数:63
算法设计和分析(Prim算法构建最小生成树)
问题: 给定无向图G(N,M)表明图G有N个顶点,M条边,通过Prim算法构造一个最小生成树 分析: 算法流程: 构造好的最小生成树就是step6 运行代码: #include<cstdio> #include<string.h> #include<algorithm> #include<cmath ...
分类:编程语言   时间:2020-02-28 01:07:24    阅读次数:149
共11758条   上一页 1 ... 75 76 77 78 79 ... 1176 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!