自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

奋斗的Die Young

生命不息,奋斗不止!

  • 博客(151)
  • 收藏
  • 关注

原创 Apollo 8.0 Monitor逻辑梳理

介绍Apollo 8.0中Monitor模块的具体业务逻辑

2023-03-15 15:54:23 538

原创 CentOS 7.0 Django博客项目环境搭建

安装lz,rz:yum install lrzsz安装mysql# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm#rpm -ivh mysql-community-release-el7-5.noarch.rpm# yum install mysql-community-server安装完毕之后需要重启...

2018-04-02 13:56:45 288

原创 DoesNotExist at /admin/login/

如果代码中有site = Site.objects.get_current().domain那么就要在setttings.py中添加SITE_ID=2,要不就报错了。

2018-03-09 10:22:01 2567

原创 Django框架路由总结

拿上面的Django项目当例子,真实的Django项目会有很多例如cmdb的应用,我这里就一个。Dynamic/urls.py是总的路由,在这里进行路由分发,分发到每一个应用中。总的路由文件由settings.py中的 代码决定。Dynamic/urls.py代码:用include()函数来进行路由分发到具体的应用中,如 cmdb.urls 。前提是在每个应用中都已经有urls.py,这个文件在应...

2018-02-28 18:11:19 637

原创 论程序员的自我驱动力

今天在翻技术博客的时候,无意中看到了一句话,送给自己:人在什么时候能够自我驱动?就是痛苦的时候。 只有感到痛苦,才会有改变。 当然改变有两种结果,一种是彻底放弃沉沦,另外就是一想办法自动化、智能化,把自己变成一个高手。

2017-12-27 17:11:18 421

原创 海明码检验和纠错

/* 海明码检验与纠错.*/#include #include #include using namespace std;/* 测试样例 110010100000 0011101 1110110 011001011001 0001001*/char s[105]; // 用来接收信息位字符串char ans[1005]

2017-05-04 17:53:26 857

原创 模拟海明码生成

/* 生成海明码.*/#include #include #include using namespace std;/*测试样例:01101110 - - ->0110011110011101 - - ->11001100010 - - ->0011001*//* 此程序没有代码优化,所以按照思路来代码比较凌乱。 欢迎补充测试样例,和对此代码

2017-04-24 19:43:03 849

原创 CCF俄罗斯方块

心得:记录坐标就好。代码:#include int a[20][20];int b[5][5];int pos,co;struct node{ int x,y;}c[5];int main(){ for(int i = 1;i <= 15;++i) for(int j = 1;j <= 10;++j)

2017-03-16 18:24:57 991 2

原创 CCF炉石传说

心得:写这种题关键就是操作分开写,写完一个测试一个。要不然代码多,调试困难,思路乱,导致做错。代码:#include #include #include #include using namespace std;struct sss{ int health; int attack;};int f,fff;struct hero{ int

2017-03-15 20:19:39 435

原创 CCF权限查询

问题描述试题编号:201612-3试题名称:权限查询时间限制:1.0s内存限制:256.0MB问题描述:问题描述  授权 (authorization) 是各类业务系统不可缺少的组成部分,系统用户通过授权机制获得系统中各个模块的操作权限。  本题中的授权机制是这样

2017-03-14 17:45:58 267

原创 树状数组学习笔记

题目从易到难1. POJ2309 http://poj.org/problem?id=2309熟悉lowbit代码:#include #define T long longT lowbit(T x){ return x & (-x);}T getMin(T x){ //printf("test\n"); while(lowbit(x

2016-11-25 19:12:38 241

原创 hdu1466计算直线的交点数

这道题是从HDU课件上看到的,而且是DP的课件。推导过程来自PPT:当n = 20 时, 最大的交点数 = 1 + 2 + ... + (n - 1) = n * (n - 1) / 2 = 190很容易看出前四个答案  n = 0    0n = 1    0n = 2    0 1n = 3    0 2 3 (解释一下: 0是三条直线平行的情况,2是两条直

2016-11-10 18:33:03 324

原创 POJ3069Saruman's Army(贪心)

题意:给一些点,然后给一些射程为r的炮弹,问最少需要几个点上安装这种炮弹能覆盖这些点。思路:先把点排序,然后从第一个点开始找炮弹安装的位置,这个位置当然是覆盖越多的点越好,所以尽量把炮弹安装在 左面和右面都有点的地方(也就是某一些点的中间),这样贪心可以达到局部最优解,从而达到全局最优解。例子:r = 10 n = 71  7 15 20 30 50 70第一法炮弹肯定

2016-11-08 14:07:50 242

原创 最小生成树模板.

prim:#include #include const int INF = 0x3f3f3f3f;const int maxn = 110;bool vis[maxn];int lowc[maxn];int prim(int cost[][maxn],int n) //dian bian hao 0 ~ n - 1{ int ans = 0; memset

2016-10-30 22:39:00 285

原创 NYOJ143逆康托展开

康托展开式: x = an * (n - 1)! + an - 1 * (n - 2)! +....+ a2 * 1! + a1 * 0! 其中    n为数据集中元素的个数(没有重复元素),  ai为 元素在数据集中是第 ai大元素,   0有个很好的例子,博客地址http://blog.csdn.net/zhongkeli/article/details/6966805

2016-10-19 21:28:36 342

原创 uva140带宽

写的比较乱,全排列 的形式 + 回溯代码:#include #include #include using namespace std;char s[1000];int k ;//结点个数int v[100];struct node{ char name; char next[15]; int len; int flag;}a[30],b[10

2016-10-17 17:50:46 243

原创 hdu1075What Are You Talking About(字典树,map)

使用二分肯定超时了。map做法:#include #include #include #include #include using namespace std;const int N = 3005;char s[N];map f;int main(){ string x; cin >> x; while(cin >> x &&

2016-10-15 18:27:51 342

原创 uva129困难的串(dfs+判断)

思路:就是检查每一个位置应该填什么,并且填完要保证是不能有相邻的自子串,只需要从后向前枚举长度i = 2.....(当前字符串长度 + 1) / 2,然后判断一下就行,具体看代码,有点乱。。代码:#include #include int n,l;char ans[100];int flag;int cnt ;FILE *fw;bool check(cha

2016-10-12 22:52:02 425

原创 uva524素数环

回溯法应用。代码:#include #include #include const int maxn = 100;int n;int a[maxn];int v[maxn];int v1[maxn];void Eratoshenes(int n) //素数筛{ int m = sqrt(n); memset(v,0,sizeof(v));

2016-10-12 18:27:04 233

原创 hdu1397素数筛+打表+标记+二分

呵呵呵呵呵。。代码:#include #include #include #include using namespace std;const int maxn = 1 << 15;int f[maxn + 5] ;vector primes;int v[maxn + 5];int v1[maxn + 5];void Eratoshenes(int n)

2016-09-30 18:16:51 371

原创 uva489 (模拟加判断)

源码#include #include #define maxn 1000005char s[maxn],s1[maxn];int v[30];int len_s,len_s1;int error ;bool guess(char c){ int r = strlen(s); int flag = 0; if(v[c - 'a'])

2016-09-27 19:25:04 340

原创 uva1339古老的密码

理解题意真的很重要,题目说某种映射,而不单单是 B->A ,C -> B 这种的。源码:#include #include #include using namespace std;char s[105],s1[105];int s_v[105],s1_v[105];int main(){ while(~scanf("%s%s",s,s1)) {

2016-09-26 17:37:09 303

原创 uva10340 (字符串模拟)

不解释,直接上源码。#include #include const int maxn = 1e6 + 5;char s[maxn],t[maxn];int main(){ while(~scanf("%s%s",s,t)) { int len_s = strlen(s); int len_t = strlen(t);

2016-09-26 17:00:07 209

原创 uva1368Consensus String(水)

一开始理解错了题意,以为要求的序列是m个中的一个。。源码#include #include #include using namespace std;int n,m;char s[55][1005];char ans[1005];int a[30];int main(){ int t; scanf("%d",&t); whi

2016-09-21 17:48:46 226

原创 uva232Crossword Answers

模拟不解释。源码#include #include #include using namespace std;char s[15][15];int f[15][15];int n,m;struct N{ int num; char s1[20];}down[105];bool cmp(N x,N y){ return x.num

2016-09-21 16:41:18 265

原创 uva401Palindromes

这个题的核心就是判断镜像字符串,镜像字符串是不能包含 没有reverse的字符的,例如B C代码:#include #include char s[100];bool is_h(){ int len = strlen(s); if(len == 1) return 1; int i = 0,j = len - 1; w

2016-09-19 22:57:51 165

原创 NYOJ483噩梦(优先队列 + 无标记)

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=483本题重点是访问完一次4之后要置成1或者0,防止多次重置。 因为这个我错了好多次。代码:#include #include #include #include #include using namespace std

2016-09-18 20:02:32 288

原创 NYOJ760又见LCS

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=760思路: 如果按正常的思路,都开不下那么大的数组,并且时间是1S。 注意到题目说一个序列中的数两两不同,这样我们就可以把第一个数组出现在数字的下标都记下来,然后对照第二个数组 再生成一个下标数组,求这个生成的数组的最长单调递增子序列就可以了。代码:#inclu

2016-09-18 18:03:36 255

原创 uva12716GCD等于XOR(预处理)

本题用到的知识点: 三个正整数a,b,c , 如果有a ^ b = c,那么 三个数中任意两个数异或都会得第三个数。例:a ^ c = b;gcd(a,b) = a ^ b = c  ;因为c是a,b的最大公约数, 可以枚举a,c,求出b,判断 是否有gcd(a,b) = c; 优化:打印一些解,发现a - b = c;只需要判断 a -

2016-09-16 18:48:44 668

原创 uva10375选择与除法

本题用到了唯一分解定理。模拟是超时的。代码:#include #include #include #include #include using namespace std;const int maxn = 1e4 + 5;int v[maxn];int e[maxn];int p,q,r,s;void Eratoshenes(int n) //素数筛

2016-09-15 21:58:03 219

原创 uva12563劲歌劲舞

一开始竟然读错了题意,没有注意到歌曲数量优先这个条件。。。。代码:#include #include #include using namespace std;int T;int n,t;int a[100];int f[55][9005];int d[55][9005];int main(){ scanf("%d",&T); in

2016-09-15 15:38:52 242

原创 uva116Unidirectional TSP

思路: 从后像前递推,然后正向的打印路径。代码:#include #include using namespace std;int m,n;int mp[15][110];int f[15][110];void print_ans(int k,int l){ if(l == n) return ; for(int i = 1;

2016-09-13 17:20:55 466

原创 uva1347Tour

按照LRJ的思路,f[i][j] 为第一个人走到第i个点 第二个人走到第j个点(i > j) 最少还需要走多少距离。代码:#include #include #include #include using namespace std;#define inf 2e9const int maxn = 1005;struct node{ double x,y;}a

2016-09-13 15:12:01 229

原创 NYOJ1092数字分隔(二)(水水)

参照了别人的思路。代码:#include #include const int maxn = 120;char s[maxn];int main(){ while(~scanf("%s",s + 1)) { int flag = 0; //标记是否有负号 char* point; int len ;

2016-09-12 18:40:54 459

原创 uva11582Colossal Fibonacci Numbers!(快速幂+预处理)

这个题不预处理要超时的。。代码:#include #include #include #include using namespace std;#define ll unsigned long longconst int maxn = 1e6;ll a,b;int n;vector f[1005];int c[1005];void init(){

2016-09-09 20:23:56 228

原创 uva437The Tower of Babylon(不一样的dp)

我的思路和刘汝佳老师的思路不一样:思路: 把一个立方体变成6个立方体 ,即长宽高都不一样。定义状态: d[i] 为以下标为i的木块为起点所能摞的最高的高度,记忆化搜索就可以了。代码(有点长)#include #include #include using namespace std;struct node{ int a,b,c;

2016-09-07 19:33:26 326

原创 Uva1025A Spy in the Metro

一道dp的题 :dp[i][j] 表示从在时刻i 处在j站台 所需要最少还要等待多少时间此时有3中决策1.等1分钟2.上开往右侧的火车(如果有的话)3.上开往左侧的火车(如果有的话)边界条件 dp[T][n] = 0;  for( i = 1 to n - 1) dp[T][i] = INF;要求出 dp[0][1]

2016-09-06 19:37:28 269

原创 NYOJ21三个水杯

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=21思路:一共分12种情况  举个例子 A -> C倒水的时候,可能把C装满,可能不满。这就是两种情况     所有的情况 A -> B (B可能满,可能不满)                       A -> C                       B

2016-09-03 15:07:33 263

原创 NYOJ592spiral grid

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=592 思路:(1)建图  (2)打素数表 (3)BFS搜索代码:#include #include #include int s[110][100];int v[110][100];int t_cnt = 1;bool flag ;typ

2016-09-02 23:38:30 249

原创 NYOJ523亡命逃窜

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=523这个题不能用STL的优先队列了,要不会超时。还是BFS搜索最优解.这个城堡由A层,每层的大小是B * C的,入口在(0,0,0),出口在(A - 1,B - 1,C - 1)处,在给定时间内出去就好思路:先搜索本层,在搜索邻接的两层。

2016-09-02 19:48:59 367

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除