![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
====模板====
文章平均质量分 67
liluoyu_1016
这个作者很懒,什么都没留下…
展开
-
c++ 输入输出优化
输入优化 inline int read(){ int x=0,w=1; char ch=0; while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar(); if(ch=='-') { w=-1; ch=getchar(); }...原创 2017-08-02 15:10:41 · 215 阅读 · 0 评论 -
hdu 1028 Ignatius and the Princess III 生成函数 模板题
Problem Description"Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says."The second problem is, given an positive integer N, we define an equ...原创 2018-08-18 09:55:34 · 178 阅读 · 0 评论 -
Evacuation POJ - 3057 二分图匹配+bfs
Fires can be disastrous, especially when a fire breaks out in a room that is completely filled with people. Rooms usually have a couple of exits and emergency exits, but with everyone rushing out at t原创 2018-04-29 10:31:49 · 201 阅读 · 0 评论 -
Detachment HDU - 5976 前缀+逆元+贪心
In a highly developed alien society, the habitats are almost infinite dimensional space. In the history of this planet,there is an old puzzle. You have a line segment with x units’ length representi...原创 2018-05-18 21:06:49 · 217 阅读 · 0 评论 -
Image copy detection HDU - 3523 最小费用流
The success of the Internet and cost-effective digital storage device has made it possible to replicate, transmit, and distribute digital content in an effortless way. Thus, the protection of intellec原创 2018-04-25 22:12:34 · 206 阅读 · 0 评论 -
最长回文 HDU - 3068 马拉车模板题
给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度. 回文就是正反读都是一样的字符串,如aba, abba等 Input 输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S 两组case之间由空行隔开(该空行不用处理) 字符串长度len Output 每一行一个整数x,对应一组case,表示该组c原创 2018-05-02 21:01:25 · 165 阅读 · 0 评论 -
Flow Problem HDU - 3549 Dinic
Network flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for the weighted directed graph.Input The first line of input contains an inte原创 2018-04-19 19:21:40 · 139 阅读 · 0 评论 -
Courses HDU - 1083 匈牙利算法模板
Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to form a committee of exactly P students that sa原创 2018-04-23 21:59:42 · 161 阅读 · 0 评论 -
求割点
#include#include#includeusing namespace std;const int M=10000;struct node{ int to,next;}e[M];int dfn[110],low[110];int head[110],vis[110];int cnt[110];int m,ci,root;void add(int u,int原创 2017-11-18 09:34:45 · 150 阅读 · 0 评论 -
Drainage Ditches HDU - 1532 最大流 模板
Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long time to regrow. Thus, Fa原创 2018-04-19 09:44:12 · 141 阅读 · 0 评论 -
统计难题 HDU - 1251 trie树
Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符串原创 2018-03-25 10:20:44 · 135 阅读 · 0 评论 -
欧拉函数
1.求小于n与n互质的个数int euler(int n){ int ret=1,i; for( i=2;i*i<=n;i++) { if(n%i==0) { ret*=i-1; n/=i; } while(n%i==0)原创 2017-08-02 16:01:52 · 248 阅读 · 0 评论 -
矩阵 快速幂
1. 快速幂 O(logn)#include#includeusing namespace std;typedef long long ll;ll mod_pow(ll x,ll n){ ll ret=1; while(n>0) { if(n&1) ret=ret*x; x=x*x; n>原创 2017-08-09 11:24:52 · 154 阅读 · 0 评论 -
次小。最小生成树
#include#include#includeusing namespace std;const int M =500;const int inf=0x3f3f3f3f;int t,n,m;int vis[M];int low[M];int pre[M];int dis[M][M],cost[M][M];int used[M][M];int prim(int st,int原创 2017-11-14 20:16:29 · 166 阅读 · 0 评论 -
最短路模板
1.bellman--ford 2.dijkstra 算法3.spfa4.dijkstra+堆优化5.dijkstra+堆优化+链式前向星+路径还原原创 2017-08-24 10:04:42 · 231 阅读 · 0 评论 -
GCD HDU - 1695 莫比乌斯模板
Given 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x and y. Since the number of choices may be very large, you're...原创 2018-09-11 19:52:45 · 540 阅读 · 0 评论