模板例题
部分算法模板例题
无糖卡布奇诺
吃得苦中苦,方为人上人
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
__int128输入输出模板
#include <bits/stdc++.h> using namespace std; inline __int128 read(){ __int128 x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0'&&ch<.原创 2020-08-04 19:07:32 · 326 阅读 · 0 评论 -
HDU-1686 Oulipo(KMP计算模式串匹配次数)
链接:HDU-1686 题意:模式串在主串中出现了多少次 思路:kmp改一下就好了 总结:TLE的故事告诉我们,一定一定谨慎使用cin cout。。。。。。 #include<bits/stdc++.h> using namespace std; #define inf 0x3f3f3f3f const int maxn = 1000005; char a[maxn],b[...原创 2018-12-03 20:01:17 · 713 阅读 · 0 评论 -
HDU 3068(Manacher模板)
切记不用cin cout,超时太真实了 #include<bits/stdc++.h> using namespace std; const int maxn=110005; int n; int len[maxn*2]; char s[maxn],str[maxn*2]; void init() { memset(str,0,sizeof(str)); me...原创 2018-12-02 22:45:38 · 247 阅读 · 0 评论 -
洛谷 P3376【模板】网络最大流(网络流模板)
传送门 #include<bits/stdc++.h> using namespace std; #define ll long long const int maxn = 100005; const int maxm = 2000005; const int inf = 0x3f3f3f3f; struct DINIC { struct node { int u,v,...原创 2019-07-26 18:26:50 · 250 阅读 · 0 评论 -
洛谷 P3649 回文串(回文树模板题)
传送门 /********************** 洛谷 P3649 题意:给你一个字符串,求一个最大的值(回文字符串长度*出现次数) 思路:回文树模板题,取一个max(len[i]*cnt[i])从[0-id)(注意ll) 关于回文树模板:id表示每种本质不同的回文字符串编号,len数组表示 每种本质不同的回文字符串长度,cnt数组表示每种不同回文字符串的个数 *******...原创 2019-07-26 14:56:59 · 303 阅读 · 0 评论 -
POJ 2104 (区间第K小,主席数模板)
POJ 2104 /** POJ 2104 区间第K小,主席数模板 **/ #include<iostream> #include<cstdio> #include<algorithm> #include<vector> #define INF 0x3f3f3f3f #define eps 1e-8 using namespace std; #d...原创 2019-07-24 19:07:23 · 209 阅读 · 0 评论 -
HDU 1402 A * B Problem Plus(高精度乘法FFT模板题)
题目链接:点这里 题目大意:A*B=??? 解题思路:FFT模板,别问为什么,问就是不会(脑部滑稽) #include<bits/stdc++.h> using namespace std; typedef long long LL; const double PI=acos(-1.0),eps=1e-8; #define L(x) (1 << (x...原创 2019-07-08 23:50:05 · 276 阅读 · 0 评论 -
二分图匹配-匈牙利算法(HDU-2063 过山车)
题目链接:过山车 题目大意:几个男生和女生要去坐过山车,每个男生都有自己感兴趣的女生,他们要进行选择,问最多可以凑出几对 题目思路:这是一个典型的二分图匹配,使用匈牙利算法即可解决 匈牙利算法,分为两个过程,首先是匹配过程,其次是查找过程 匹配过程: int match() { int ans=0; for(int i=1;i<=a;i++){ ...原创 2018-12-10 22:27:54 · 331 阅读 · 0 评论
分享