题意:
给出N个字符串,要求选出若干个,使得选中的字符串的公共前缀长度与选中字符串的个数的乘积最大。
分析:
简单粗暴的Trie模板题。
对于Tire中的每一个结点添加两个信息:该结点的深度及该结点杯访问的次数,最后求出这两个信息的最大值就行了,边加入字符串边维护就行。...
分类:
其他好文 时间:
2014-10-04 22:39:07
阅读次数:
281
——转载:一、概述: Sorted-Sets和Sets类型极为相似,它们都是字符串的集合,都不允许重复的成员出现在一个Set中。它们之间的主要差别是Sorted-Sets中的每一个成员都会有一个分数(score)与之关联,Redis正是通过分数来为集合中的成员进行从小到大的排序。然而需要额外指出的是...
分类:
其他好文 时间:
2014-10-01 14:21:01
阅读次数:
215
题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=3836
Equivalent Sets
Time Limit: 12000/4000 MS (Java/Others) Memory Limit: 104857/104857 K (Java/Others)
Total Submission(s): 2890 Accep...
分类:
其他好文 时间:
2014-10-01 08:52:10
阅读次数:
307
插空法 大组合数取余
#include
#include
using namespace std;
typedef long long LL;
//求整数x和y,使得ax+by=d, 且|x|+|y|最小。其中d=gcd(a,b)
void gcd(LL a, LL b, LL& d, LL& x, LL& y)
{
if(!b)
{
d = a;
x = 1;
y = ...
分类:
其他好文 时间:
2014-09-29 19:37:31
阅读次数:
218
题目大意:给出n个数,要求将n个数分配到两个集合中,集合0中的元素x,要求A-x也再0中,同理1集合。
写了几个版本,一直WA在第8组数据...最后参考下ans,写了并查集过了
学到:1、注意离散的逻辑思维,官方答案的 从条件推逆否命题
2、并查集做法:fa[find(i)]=mp[a-p[i]]
? find(a-p[i]) :
find(n+2);
3、离散化然后has...
分类:
其他好文 时间:
2014-09-28 18:42:35
阅读次数:
240
今天做了一个身份验证页面,基本实现功能,却不能显示当前用户姓名,自己MSDN半天一无所获,问题就在Context.User.Identity.Name;Context是HttpContext类,User属性Gets or sets security information for the curre...
分类:
Web程序 时间:
2014-09-28 10:40:41
阅读次数:
182
public class Ziji { public static List> Sets(int a[]) { List> res = new ArrayList>(); int len = a.length; int n = 1 0; i--) {...
分类:
其他好文 时间:
2014-09-26 21:36:28
阅读次数:
137
Let us consider sets of positive integers less than or equal to n. Note that all elements of a set are
different. Also note that the order of elements doesnt matter, that is, both {3, 5, 9} and {5, 9...
分类:
其他好文 时间:
2014-09-26 02:35:48
阅读次数:
191
题目链接:Codeforces 468B Two Sets
题目大意:给出n个数,要求将n个数分配到两个集合中,集合0中的元素x,要求A-x也再0中,同理1集合。
解题思路:类似二分图匹配的方法。
#include
#include
#include
#include
#include
using namespace std;
const int maxn = 1e5...
分类:
其他好文 时间:
2014-09-25 13:13:38
阅读次数:
240
1.select2介绍 官网: http://ivaynberg.github.io/select2/ Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, a...
分类:
Web程序 时间:
2014-09-24 12:22:16
阅读次数:
1379