![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
文章平均质量分 75
bean244
这个作者很懒,什么都没留下…
展开
-
POJ 3630 Trie树
#include#include#include#include#includeusing namespace std;#define N 101000struct st{ bool isLeaf; int next[10];}trie[N];int nodep;int root;int new_node(){原创 2012-11-30 20:58:15 · 345 阅读 · 0 评论 -
POJ 2362 Square
Time Limit: 3000MS Memory Limit: 65536KTotal Submissions: 17137 Accepted: 5909DescriptionGiven a set of sticks of various lengths, is it possible to join them end-to-end to原创 2013-04-16 23:31:04 · 479 阅读 · 0 评论 -
分层遍历二叉树
用map存储节点 key表示节点编号, value 是儿子,用pair实现。遍历采用 bfs 、 优化在于 level 部分#include#include#include#include#includeusing namespace std;typedef pair Son;typedef map Tree;void bfs(Tree t,int root)原创 2013-03-07 14:11:40 · 536 阅读 · 0 评论 -
Poj 3428 Formatting function
Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 2275 Accepted: 313DescriptionText formatting functions (Format, sprintf, etc) are very common between programming原创 2013-01-25 20:43:43 · 622 阅读 · 1 评论 -
POJ 1840 双向搜索 +Hash
EqsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 9536 Accepted: 4697DescriptionConsider equations having the following form: a1x13+ a2x23+ a3x33+ a4原创 2012-12-08 20:08:01 · 405 阅读 · 0 评论 -
POJ 3277 用堆求矩形轮廓面积
City HorizonTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 14291 Accepted: 3867DescriptionFarmer John has taken his cows on a trip to the city! As the原创 2012-12-07 17:55:14 · 427 阅读 · 0 评论 -
POJ 3264 树状数组 区间最值查询
Balanced LineupTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 25427 Accepted: 11872Case Time Limit: 2000MSDescriptionFor the daily milking, Farme原创 2012-12-07 22:00:18 · 532 阅读 · 0 评论 -
HDU 2049 错位排序 + 高精度
考新郎Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14155 Accepted Submission(s): 5281Problem Description国庆期间,省城HZ刚刚举行了一场盛大的集体原创 2012-12-03 14:58:22 · 463 阅读 · 0 评论 -
HDU 1272 并查集
小希的迷宫Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15807 Accepted Submission(s): 4811Problem Description上次Gardon的迷宫城堡小希玩了很久原创 2012-12-02 21:04:02 · 315 阅读 · 0 评论 -
POJ 3370 Halloween treats 鸽巢原理
POJ 3370 Halloween treats题意: 给定n户人家提供的糖果数目,c个小孩选择其中一些用户把糖果拿走,最后平分,不能有剩余。 给出一个方案(c方案:鸽巢原理,用Si表示 前i户人家的糖果数目之和对c求余。n>c,根据鸽巢原理,肯定有两个和值对c求余的值相同,假设Si==Sj,第 (i+1,i+2,i+3,……,j ) 户人家即为答案。#include#includ原创 2012-11-23 19:22:17 · 529 阅读 · 0 评论 -
找到至少一个重复元素
一个大小为n的数组,里面的数都属于范围[0, n-1],有不确定的重复元素,找到至少一个重复元素,要求O(1)空间和O(n)时间。#include#include#includeusing namespace std;pair find_dup(int a[],int n){ for(int i=0;i<n;i++){ while(a[i]!=i){ int k原创 2013-04-07 17:01:29 · 553 阅读 · 0 评论