题意:中文的题目,意思就是说有很多串,每个串都有权值,权值为999的串必须出现,-999的串必须不出现。权值在-999~999之间。
然后必须出现的串不超过8个。然后给一个全为小写目标串,问最少需要删除多少个字母才能够保证必须出现的串都出现,次数一样保证权值最大。输出次数和权值。
然后根据样例,那些必须出现的串,其实权值是0。
思路:
很明显一开始建自动机构成trie图,但是需要注...
分类:
其他好文 时间:
2015-03-10 10:29:38
阅读次数:
130
(Version 0.0)这题是算法导论的书后习题,也是迄今为止LeetCode上面第二个我没想太长时间就直接放弃的题。第一个主动放弃的是Valid Number,那个题是因为嫌繁琐没什么太大意义,而这一个题则是感觉难度真的很大,如果之前没看过相关的东西的话自己做我觉得比AC Rate所体现的其实要...
分类:
其他好文 时间:
2015-03-10 10:14:17
阅读次数:
142
一:安装Nginx 1,添加一个不能登录且没有主目录的用户: # useradd www -M -s /sbin/nologin(www可以用nginx,说明是nginx用户) 2,必要的组件 # wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcr...
分类:
数据库 时间:
2015-03-10 00:17:23
阅读次数:
317
【思路】:排序。可以用 sort 或者 qsort ,或者常见的冒泡。
【AC代码】:
常规:
#include
#include
using namespace std;
#define MAX 200+10
int main()
{
int i = 0, n = 0;
int num[MAX];
cin >> n;
for (i = 0; i < n; i++)
cin...
分类:
编程语言 时间:
2015-03-10 00:13:44
阅读次数:
174
闰年判断
【AC代码】:
#include
#include
using namespace std;
int main()
{
int y = 0;
cin >> y;
if (((0==y%4)&&(0!=y%100))||(0==y%400))
cout << "yes";
else
cout << "no";
}
01子串
【AC代码】:方法很多,最简单的。...
分类:
其他好文 时间:
2015-03-10 00:13:09
阅读次数:
246
#include#include#includeusing namespace std;const int MAXV=510;const int INF=0x3fffffff;int n,m,c1,c2;bool vis[MAXV];int G[MAXV][MAXV]; //城市间距离in...
分类:
其他好文 时间:
2015-03-09 23:43:23
阅读次数:
217
Problem H
Matrix Matcher
Input: Standard Input
Output: Standard Output
Given an N * M matrix, your task is to find the number of occurences of an X * Y pattern.
Input
The first line contai...
分类:
其他好文 时间:
2015-03-09 22:29:58
阅读次数:
212
Mvc路由运行机制: 首先,Web 浏览器向服务器发送一条URL 请求,如http://HostName/ControllerName/ActionName/Parameters。其次,请求被ASP. NET MVC 的路由映射系统获取, 并按照映射规则, 解析出 ControllerName,Ac...
分类:
Web程序 时间:
2015-03-09 22:13:23
阅读次数:
184
Description
The alphabet of Freeland consists of exactly N letters. Each sentence of Freeland language (also known as Freish) consists of exactly M letters without word breaks. So, there exist exactly...
分类:
其他好文 时间:
2015-03-09 21:00:06
阅读次数:
146
#include#include#includeusing namespace std;const int MAXV=510;const int INF=0x3fffffff;int N,M,S,D; //城市数,高速公路数,起点,终点bool visit[MAXV]; //标记...
分类:
其他好文 时间:
2015-03-09 20:38:33
阅读次数:
170