- 博客(25)
- 收藏
- 关注
原创 九度OJ 1482 BFS+HASH
题目1482:玛雅人的密码 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:3904 解决:972 题目描述: 玛雅人有一种密码,如果字符串中出现连续的2012四个数字就能解开密码。给一个长度为N的字符串,(2= 输入: 输入包含多组测试数据,每组测试数据由两行组成。 第一行为一个整数N,代表字符串的长度(2
2017-09-16 17:36:37
339
原创 POJ3083 DFS+BFS
Children of the Candy Corn Time Limit:1000MS Memory Limit:65536K Total Submissions:14239 Accepted:6157 Description The cornfield maze is a popular Halloween treat
2017-09-16 09:52:52
304
原创 POJ1233 Prim Kruskal
还是畅通工程Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 49358 Accepted Submission(s): 22539 Problem Description某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距
2017-09-16 08:14:57
323
原创 HDU1232 Prim
畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 57583 Accepted Submission(s): 30795 Problem Description 某省调查城镇交通状况,得到现有城镇道路
2017-09-16 07:13:31
294
原创 POJ1231 max sum sequences DP
最大连续子序列 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 34628 Accepted Submission(s): 15711 Problem Description 给定K个整数的序列{ N1, N
2017-09-16 01:38:38
573
原创 POJ1753 枚举
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 46853 Accepted: 20050 Description Flip game is played on a rectangular 4x4 field with two-sided p
2017-09-15 18:58:21
324
原创 poj1595 素数打表
Prime Cuts Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 11673 Accepted: 4446 Description A prime number is a counting number (1, 2, 3, ...) that is even
2017-09-14 20:10:30
237
原创 poj3006 素数
Dirichlet's Theorem on Arithmetic Progressions Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 19139 Accepted: 9613 Description If a and d are relatively p
2017-09-14 19:46:13
219
原创 poj2251 BFS大法好
Dungeon Master Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37528 Accepted: 14351 Description You are trapped in a 3D dungeon and need to find the quick
2017-09-14 01:10:42
280
原创 poj1321 DFS
棋盘问题 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 50621 Accepted: 24518 Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求
2017-09-13 22:50:47
231
原创 八数码 BFS+HASH
#include #include #include //getline在这里 #define maxn 1000000 #define hasn 1000003 using namespace std; typedef int st[9]; st queue[maxn]; int dir[2][4] = {0,0,-1,1,1,-1,0,0};//下、右、上、左 char *prnt =
2017-09-13 21:12:57
536
原创 poj2533 最最最基础的最长上升子序列 普通版+二分法版
Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 55298 Accepted: 24789 Description A numeric sequence of ai is ordered if a1 a2
2017-09-12 22:13:39
238
原创 分段上升子序列,二次DP (poj1239)(留坑待完善。。。)
dp经典题。思路是对的但要改一下数据存储方式。。因为80个字符表示的数字int放不下。。。。 #include #include #include #include #define maxn 100 using namespace std; char a[maxn]; int len,last; int bk[maxn]; int v[maxn][maxn],front[max
2017-09-12 21:51:20
273
原创 poj1458 LCS 基础dp
Common Subsequence Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 54939 Accepted: 22901 Description A subsequence of a given sequence is the given sequenc
2017-09-12 10:03:13
242
原创 poj1006 模拟
Biorhythms Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 138991 Accepted: 44608 Description Some people believe that there are three cycles in a person's
2017-09-11 21:40:37
342
原创 POJ1276 多重背包
Cash Machine Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 36959 Accepted: 13408 Description A Bank plans to install a machine for cash withdrawal. The m
2017-09-10 20:55:25
346
原创 poj3181 完全背包+整数拆分
Dollar Dayz Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7840 Accepted: 2922 Description Farmer John goes to Dollar Days at The Cow Store and discovers
2017-09-10 19:31:59
415
原创 poj3624 基础01背包问题 闲来无事划划水啦~
Charm Bracelet Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 41224 Accepted: 17934 Description Bessie has gone to the mall's jewelry store and spies a
2017-09-10 17:24:53
334
原创 ccf 交通规划 dijkstra+最小路径花费
优先队列+邻接链表实现的dijkstra,在判断优先级时增加对该条路径花费的判断,如果最短路径相同,添加最小花费路径。 真是力不从心了,写个最短路径都写了一下午,默默吐槽一下自己。。 #include #include #include #include #define maxn 10005 #define inf 1<<27 using namespace std; struct node{
2017-09-07 17:31:16
597
原创 ccf 201612-4 压缩编码 石子合并问题(DP+平行四边形优化)
学无止境~ 平行四边形优化为啥成立还在思考中~ //石子问题 平行四边形优化 #include #define maxn 1002 #define inf 0x3fffffff #define min(a,b) a<b?a:b using namespace std; int n; int a[maxn],dp[maxn][maxn],p[maxn][maxn],sum[maxn]; int
2017-09-07 00:06:00
375
原创 hdu1026 BFS+路径保存
啊!!想抽自己!又是这种字符型迷宫的输入!!老是忘记getchar()会把空格回车都算进去!!! 新get路径保存的方法。。原来不用每个节点存路径。。。暴风哭泣 //递归打印路径。学习了 #include #include #include #define maxn 102 using namespace std; struct node{ int x,y,sec; node(int xx
2017-09-06 21:35:56
358
原创 hdu1016 DFS+素数判断
总是不好好审题。总结一下自己不看题容易犯的错: 1.漏掉某个重要条件。如此题的必须为1开头,之前还有一道迷宫题也是。 2.打印格式问题 3.可能是多个样例输入 !!! 在这点上栽了很多次了。 4.不同答案的英文格式问题。 此题是最简单的DFS+素数判断,素数直接照搬之前学习的一个单个素数判断方法,非常强悍~ //hdu1016 单个素数判断+搜索 #include #inc
2017-09-06 20:13:44
314
原创 hdu1025 最长上升子序列 O(nlogn)优化版
这题坑点挺多。 首先,输入很大,虽然看懂了是最长上升子序列,但第一次用朴素查找,妥妥的超时了。。 学习一下二分查找LIS,可以优化到O(nlogn)。 还有就是英文输出时,一定要注意复数复数!!之前有道题也是用到各种数序的英文输出。不注意的话就会WA。 二分查找LIS,其实就是拿一个数组f[],下标表示长度,存放该长度序列的末尾数。该数组存放的末尾数也一定是递增的。 #inc
2017-09-06 16:41:22
375
原创 hdu1042 n! 大整数阶乘
其实就是大整数和非大整数相乘 要注意更新数组长度 #include #include #define maxn 40002 using namespace std; static int sum[maxn]; void cal(int n){ memset(sum,0,sizeof(sum)); int len = 1; sum[0] = 1; int ca = 0; for(int
2017-09-06 14:12:45
261
原创 hdu1002 大整数加法
有很多小细节需要注意: 1.去除前导零 2.翻转时的char与int变换 #include #include #include #define maxn 1002 using namespace std; char aa[maxn],bb[maxn]; int sum[maxn],a[maxn],b[maxn]; int main(){ int n; scanf("%d",&n); f
2017-09-06 13:52:07
384
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅