算法模版
eIectron
优美的代码是成功AC的第一步。看着那么多博客不再更新,这就是我几年后的状态吗?要是走了就再也不回来了。
展开
-
参考小白书上用c++采用结构体重载的大数类模版
未完待续,等我学会快速傅里叶再来写除法,知道除法也就会写取余了。浮点数就拉倒了,或许我会来写写负数。#include#include#include#includeusing namespace std;const int maxn = 1000;struct bign{ int len, s[maxn]; bign() { memset(s, 0, si原创 2016-06-02 20:53:41 · 790 阅读 · 0 评论 -
线段树模版—A Simple Problem with Integers
D - A Simple Problem with IntegersTime Limit:5000MS Memory Limit:131072KB 64bit IO Format:%I64d & %I64uDescription给出了一个序列,你需要处理如下两种询问。"C a b c"表示给[a, b]区间中的值全部增加c (-10000 ≤ c原创 2016-04-29 00:03:30 · 1578 阅读 · 0 评论 -
CCCC-二叉搜索树
二叉搜索树就是左边的任何元素一定比根节点小,右边任何元素一定比根节点大或者等于根节点10:二叉排序树总时间限制: 1000ms内存限制: 128000kB描述依次给出n(0个整数,请你以这n个数创建一棵二叉排序树,这棵排序树的根节点为第一个数,并输出其中序遍历和后序遍历。输入共两行,第一行为整数n,第二行为n个整数输出共两行,第一行为中序遍历,第二行为后序遍历样例输原创 2016-07-14 10:55:29 · 617 阅读 · 0 评论 -
POJ1274 — 二分图匹配模板题
The Perfect StallTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 22876 Accepted: 10190DescriptionFarmer John completed his new barn just last week, comp原创 2016-07-23 16:41:01 · 877 阅读 · 0 评论 -
DFS示例—计算湖水个数
E - Lake CountingTime Limit:1000MS MemoryLimit:65536KB 64bit IO Format:%I64d& %I64uSubmit Status Practice POJ 2386DescriptionDue to recentrains, water has pooled in various places in原创 2016-03-27 16:45:24 · 874 阅读 · 0 评论 -
BFS示例—寻找奶牛
Catch That CowDescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the原创 2016-04-05 17:25:53 · 922 阅读 · 0 评论 -
BFS经典例题—迷宫问题
Description定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短原创 2016-04-05 19:21:53 · 12881 阅读 · 3 评论