![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
模板
q435201823
11
展开
-
大数加法 自定义函数
jia(ans,a,b)相当于ans=a+b; 输入输出都用%s输入。#include<cstdio> #include<cstring> #include<map> #define bit 1000 using namespace std; int kase = 0; int jia(char ans[], char a1[], char b1[]) { int a[bit], b[原创 2017-07-19 19:49:48 · 498 阅读 · 0 评论 -
HDU - 1599 - find the mincost route(floyd判断最小环 模板)
杭州有N个景区,景区之间有一些双向的路来连接,现在8600想找一条旅游路线,这个路线从A点出发并且最后回到A点,假设经过的路线为V1,V2,….VK,V1,那么必须满足K>2,就是说至除了出发点以外至少要经过2个其他不同的景区,而且不能重复经过同一个景区。现在8600需要你帮他找一条这样的路线,并且花费越少越好。 Input 第一行是2个整数N和M(N <= 100, M <...原创 2018-08-08 15:44:03 · 133 阅读 · 0 评论 -
迪杰斯特拉 + 堆优化 模板
堆优化用优先队列实现。 #include <iostream> #include <cstdio> #include <queue> #include <vector> #include<cstring> using namespace std; #define MAXN 205 #define INF 0x3f3f3f...原创 2018-08-07 20:32:47 · 273 阅读 · 0 评论 -
CSU - 1216 - 异或最大值(字典树)
给定一些数,求这些数中两个数的异或值最大的那个值 Input 多组数据。第一行为数字个数n,1 &amp;lt;= n &amp;lt;= 10 ^ 5。接下来n行每行一个32位有符号非负整数。 Output 任意两数最大异或值 Sample Input 3 3 7 9 Sample Output 14 Hint [分析] 就是字典树,然后儿子只有0和1 [代码] #inclu...原创 2018-08-11 20:20:34 · 176 阅读 · 0 评论 -
HDU 2222 Preview (AC自动机模板)
In the modern time, Search engine came into the life of everybody like Google, Baidu, etc. Wiskey also wants to bring this feature to his image retrieval system. Every image have a long descriptio...原创 2018-08-10 21:17:41 · 139 阅读 · 0 评论 -
ZCMU-1978-调酒壶里的酸奶(数论)
Description 最近小w学了一手调酒的技巧,这么帅的操作,说不定能靠这个俘获女神的芳心,为了在女神面前露一手,他想在学校里建一个”pub”,但是显然学校不可能让他真的建一个”pub”,那么他退而求次,想建一个”Yogurt shop”,不能用酒,那用酸奶也行啊! 今天女神终于来光顾小w的酸奶店了!兴奋的小w拿出自己准备已久每天都仔细擦干净的装备——调酒壶、果汁机、隔冰器和计量杯、砧板、...原创 2018-07-27 15:24:51 · 429 阅读 · 0 评论 -
地图类BFS模版(自用)
这一篇博客主要为了记录地图类题目的BFS步骤 以HDU1242为例子(有一点要注意的就是这题用的是优先队列,平常用普通队列) [代码] #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<queue> using nam...原创 2018-07-22 21:10:35 · 425 阅读 · 0 评论 -
HDU-2056-Rectangles(几何,两矩形重叠面积模版)
Problem Description Given two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the intersected part of two rectangles. its sides are p...原创 2018-07-28 15:26:15 · 249 阅读 · 0 评论 -
并查集模板
#include<cstdio>#define MAX 1000 struct UnionFind { int fa[MAX]; void make_set()//初始化 { for (int i = 0; i < MAX; i++)fa[i] = i; } int find_set(int x)//查 { return x原创 2017-08-15 14:34:48 · 175 阅读 · 0 评论 -
Count primes (Meissel-Lehmer算法)
Easy question! Calculate how many primes between [1…n]! Input Each line contain one integer n(1 <= n <= 1e11).Process to end of file. Output For each case, output the number of primes in interval [原创 2017-09-09 16:08:40 · 2250 阅读 · 2 评论 -
线段树模板(求最大最小)
#include<cstdio>const int INF = 0xffffff0; const long long IINF = 1e18; int minV = INF; int maxV = -INF; int max(int &a, int &b) { return a > b ? a : b; } int min(int &a, int &b) { return a < b原创 2017-08-23 10:17:06 · 253 阅读 · 0 评论 -
树状数组模板
早上刚学的,看着别人的代码写了一个适合自己风格的模板。#include<cstdio> #include<cstring> #define MAX 5000//数组大小struct FenwickTree { int arr[MAX]; int c[MAX]; int n; FenwickTree(int nn) { n = nn;原创 2017-08-13 11:23:49 · 155 阅读 · 0 评论 -
简化SPFA模板
用邻接表存图,在代码“注意1”处就不用遍历n个边,更快,所以这个模板算是个简化的模板 #include<cstdio> #include<queue> #include<cstring> using namespace std; typedef long long ll; #define maxn 205 #define INF 0x3f3f3f3f int ...原创 2018-08-08 20:41:35 · 112 阅读 · 0 评论