随笔分类 -  ------【基本算法】

1 2 3 下一页

HDU 6208 (字符串hash)
摘要:题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=6208 题意:给你n个串,能不能在这n个串中找到一个串,使得其它所有的串都是这个串的子串。 题解:找到最长的串作为主串,将主串hash一下,然后去匹配其它串即可 代码: 1 #pragma 阅读全文

posted @ 2017-10-10 19:26 Jstyle 阅读(319) 评论(0) 推荐(1)

2016-2017 ACM-ICPC Pacific Northwest Regional Contest (Div. 2) 【部分题解】
摘要:A:因为删除是不计入操作次数的,所以转化一下就是求最长上升子序列,简单dp。 设dp[i]表示前i个字符能凑成上升子序列的最大长度,dp[i] = max(dp[j]+1, dp[i]) 【j < i && s[j] < s[i]】 1 #include <bits/stdc++.h> 2 usin 阅读全文

posted @ 2017-04-03 17:48 Jstyle 阅读(1452) 评论(0) 推荐(0)

HDU - 4614 【二分+线段树维护】
摘要:Vases and Flowers Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 3263 Accepted Submission(s): 12 阅读全文

posted @ 2017-02-14 11:16 Jstyle 阅读(211) 评论(0) 推荐(0)

BZOJ - 1011【乱搞】
摘要:1011: [HNOI2008]遥远的行星 Description 直线上N颗行星,X=i处有行星i,行星J受到行星I的作用力,当且仅当i<=AJ.此时J受到作用力的大小为 Fi->j= Mi*Mj/(j-i) 其中A为很小的常量,故直观上说每颗行星都只受到距离遥远的行星的作用。请计算每颗行星的受力 阅读全文

posted @ 2017-02-03 20:41 Jstyle 阅读(204) 评论(0) 推荐(0)

codeforces - 276D【贪心+数学】
摘要:D. Little Girl and Maximum XOR time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A little 阅读全文

posted @ 2017-01-16 20:31 Jstyle 阅读(250) 评论(0) 推荐(0)

SPOJ - Palin Square【预处理+枚举】
摘要:PLSQUARE - Palin Square #dynamic-programming #hashing #dynamic-programming #hashing Kids just learnt about palindrome strings yesterday. Today, the te 阅读全文

posted @ 2017-01-15 21:40 Jstyle 阅读(286) 评论(0) 推荐(0)

SPOJ - Horace and his primes【奇淫打表+二分】
摘要:TAP2013H - Horace and his primes no tags no tags [The original version of this problem (in Spanish) can be found athttp://www.dc.uba.ar/events/icpc/do 阅读全文

posted @ 2017-01-15 21:22 Jstyle 阅读(283) 评论(0) 推荐(0)

SPOJ - Linearian Colony【分解为子问题】
摘要:COLONY - Linearian Colony no tags no tags Description Linearians are pecurliar creatures. They are odd in several ways: Every Linearian is either red 阅读全文

posted @ 2017-01-15 21:01 Jstyle 阅读(319) 评论(0) 推荐(0)

nwu 新生题解【第一套】
摘要:A:【读题+细节】 【排序+贪心】 题意: 有n张牌,分给n/2个人,每人两张,要求每个人牌上的数值之和相等,输入保证有解。 题解: 先将所有牌面排序,那么依次给每个人分配【最小,最大】【次小,次大】。。。。。。即可【学习按关键字排序】 B:【读题+细节】 题意: 给你t,s,x。且有一个序列是这样 阅读全文

posted @ 2016-12-23 13:47 Jstyle 阅读(197) 评论(0) 推荐(0)

codeforces #371div2 (ABC)
摘要:A. Meeting of Old Friends time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today an outsta 阅读全文

posted @ 2016-09-14 20:06 Jstyle 阅读(205) 评论(0) 推荐(0)

cf - 140 C. New Year Snowmen(贪心+优先队列)
摘要:C. New Year Snowmen time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output As meticulous Gerald 阅读全文

posted @ 2016-07-28 10:30 Jstyle 阅读(380) 评论(0) 推荐(0)

cf - 140 A. New Year Table(模拟)
摘要:A. New Year Table time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A. New Year Table time 阅读全文

posted @ 2016-07-28 10:14 Jstyle 阅读(251) 评论(0) 推荐(0)

POJ 2376 - Cleaning Shifts(最小区间覆盖)
摘要:Cleaning Shifts Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 17736 Accepted: 4516 Description Farmer John is assigning some of his N (1 阅读全文

posted @ 2016-07-24 16:17 Jstyle 阅读(220) 评论(0) 推荐(0)

NWU CCCC 1014(又是二叉树分冶)
摘要:题目描述很简单 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description 输入一棵树的中序遍历和先序遍历,输出后序遍历。 Input 输入多组数据。 每组数据的第一行: 树的中序遍历。 每组数据的第二行: 阅读全文

posted @ 2016-07-07 22:01 Jstyle 阅读(183) 评论(0) 推荐(0)

NWU CCCC选拔赛 1014阶乘问题(思维题)
摘要:阶乘问题 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description N的阶乘写作N!,表示小于等于N的所有正整数的乘积。 阶乘会变大得很快,如13!就必须用32位整数类型来存储,到了70!即使用浮点数也存 阅读全文

posted @ 2016-07-07 21:58 Jstyle 阅读(443) 评论(0) 推荐(0)

cf - 670C Cinema(预处理)
摘要:题目链接:http://codeforces.com/contest/670/problem/C 阅读全文

posted @ 2016-06-20 01:54 Jstyle 阅读(196) 评论(0) 推荐(0)

PAT - L2-011. 玩转二叉树(分冶)
摘要:L2-011. 玩转二叉树 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 时间限制 400 ms 时间限制 400 ms 内存限制 65536 kB 内存限制 65536 kB 代码长度限制 8000 B 代码长度限制 800 阅读全文

posted @ 2016-06-04 23:36 Jstyle 阅读(342) 评论(0) 推荐(0)

UVa - 10881 Piotr's Ants(技巧题)
摘要:题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=25979 阅读全文

posted @ 2016-06-01 08:52 Jstyle 阅读(121) 评论(0) 推荐(0)

最长回文串 O(n)复杂度(manacher算法)
摘要:manacher算法:点击打开链接 邝斌模板: 阅读全文

posted @ 2016-05-20 00:06 Jstyle 阅读(198) 评论(0) 推荐(0)

HDU - 3068 最长回文(manacher)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3068 求最长回文串,manacher算法。具体可以看转载的blog,代码如下: 阅读全文

posted @ 2016-05-20 00:00 Jstyle 阅读(129) 评论(0) 推荐(0)

1 2 3 下一页

导航