自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(84)
  • 收藏
  • 关注

原创 Ubuntu 18/20 开机没有IP地址

Ubuntu 18/20 没有IP地址Ubuntu每次重启开机之后,无法自动获取IP地址,使用 ifconfig 命令查看也没有网卡信息显示。通过一下命令可以获取动态IPsudo dhclient

2022-04-17 21:41:38 4813 1

原创 centos8更换国内源及 Status code: 404 for https:// 问题

centos8更换国内源及404问题

2022-02-17 00:59:39 5427 1

原创 GNU Octave设置编码utf-8

“编辑”栏 ,“首选项”“编辑器”,下拉到最后“文本编码用于加载和保存”,选择编码方式utf-8

2018-10-31 10:00:12 4043

原创 Ubuntu下安装Redis

在 Ubuntu 系统安装 Redis 可以使用以下命令:$sudo apt-get update$sudo apt-get install redis-server启动 Redis$ redis-server启动之后如果出现警告,可以按照警告的说明进行修改配置1.第一个警告:The TCP backlog setting of 511 cannot be enforce

2018-01-15 17:02:50 236

原创 tornado安装

github下载tornado 解压之后cd tornado-sudo python setup.py buildsudo python setup.py install安装之后测试$ pythonPython 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2Type "help", "copyright", "cr

2018-01-03 21:14:21 3641

原创 codeforces873B Balanced Substring(前缀和)

/*前缀和题意:给定一个01串,求0的个数和1的个数相同的子串最大长度预处理原来的字符串,1表示1,0表示-1依次计算处理过的字符串的前缀和,如果某个前缀和以前出现过,那么会对答案产生影响;如果是第一次出现,记录下这个位置*/#include <cstdio>#include <iostream>#include <cstring>#include <algorithm>#in

2017-10-15 20:50:22 268

原创 codeforces869EThe Untended Antiquity(二维树状数组)

/*二维树状数组+Hash题意:给一个地图(n,m) 三种操作:1,在以(r1,c1)、(r2,c2)为对角的矩形四条边上添加障碍2,消除以(r1,c1)、(r2,c2)为对角的矩形四条边上的障碍3,判断(r1,c1)到(r2,c2)是否存在一条路径,不经过障碍利用二维树状数组进行块更新,每次添加障碍时,用一个Hash值如果两个点之间的Hash值是相同的,说明可以有路径不经过障碍*/

2017-10-14 15:50:35 199

原创 HDU6185 Covering(矩阵快速幂)

/*递推公式+矩阵快速幂a(n)=a(n-1)+5*a(n-2)+a(n-3)-a(n-4)*/#include <iostream>#include <cmath>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long LL;const int m

2017-10-12 20:15:53 237

原创 codeforces 869B The Eternal Immortality

/*阶乘求a!/b!的个位数字*/#include <cstdio>#include <algorithm>#include <cstring>using namespace std;typedef long long LL;LL a,b;int main(){ while(~scanf("%I64d%I64d",&a,&b)) { LL ans=

2017-10-11 19:15:02 176

原创 Codeforeces868C Qualification Rounds(位运算)

/*位运算有n个备选题,k个队伍,1代表该队伍知道这个题目,0代表不知道是否可以选出几个题使每个队伍都知道题目总数的一半如果选多个题可以满足要求,那么其中至少有2个题可以满足要求由于k比较小,可以处理处最大的可能x,进行枚举*/#include <cstdio>#include <algorithm>#include <cstring>#include <set>using n

2017-10-09 21:23:13 158

原创 POJ - 3278Catch That Cow (bfs)

/*bfs*/#include <cstdio>#include <iostream>#include <cstring>#include <queue>using namespace std;const int maxn=1e5+5;int n,k;bool vis[maxn];int step[maxn];bool check(int x){ if(x<0||x>

2017-09-15 11:00:19 146

原创 POJ - 2251 Dungeon Master (三维bfs)

/*三维bfs*/#include <iostream>#include <cstdio>#include <cstring>#include <queue>using namespace std;const int maxn=30+5;int L,R,C;char mp[maxn][maxn][maxn];bool vis[maxn][maxn][maxn];int sx,

2017-09-14 18:18:02 159

原创 POJ - 1321棋盘问题(dfs)

/*dfs*/#include <cstdio>#include <iostream>#include <cstring>using namespace std;int n,k;char mp[10][10];bool vis[10];//第i列是否放过棋子int ans;//row为行,cnt为已经放了多少个棋子void dfs(int row,int cnt){

2017-09-14 14:47:00 230

原创 Codeforces851D Arpa and a list of numbers(素数筛)

/*素数筛有n个数,可以进行两种操作:1,删除一个数,花费x2,某个数的值+1,花费y现在想让序列所有数的gcd>1,求最小花费。(全部删除也合法)枚举数列中所有的素数i,如果某个数a[j]不是i的倍数,将其删除花费为v1=x,增加到是i倍数花费为v2=(i-a[j]%i)*y;(n-cnt)*x删除所有数,(n-cnt)*y,所有数+1*/#include <iostream>

2017-09-07 21:53:48 183

原创 51nod1287 加农炮(线段树)

/*线段树*/#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int maxn=5e4+5;int n,m;int a[maxn];struct node{ int left,right; int h;}tree[maxn<<2];void push_u

2017-08-29 15:54:40 264

原创 51nod1174 区间中最大的数

/*1,线段树查询区间最值2,RMQ*/#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long LL;const int maxn=1e4+5;int n,q;int s[maxn];int a,b;int ans;struct node{

2017-08-27 20:41:53 169

原创 51nod1069 Nim游戏

/*Nim博弈*/#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int maxn=1e3+5;int n;int a[maxn];int main(){ while(~scanf("%d",&n)) { for(int i=0;i<n;i

2017-08-27 14:49:53 198

原创 51nod1073 约瑟夫环

/*约瑟夫环f(0)=0;f(i)=(f(i-1)+k)%i*/#include <iostream>#include <cstdio>#include <cstring>using namespace std;int main(){ int n,k; while(~scanf("%d%d",&n,&k)) { int ans=0;

2017-08-27 14:11:06 239

原创 51nod1081 子段求和(前缀和)

/*树状数组求前缀和*/#include <cstdio>#include <iostream>#include <cstring>#include <cmath>using namespace std;typedef long long LL;const int maxn=5e4+5;int n,q;int pos,l;LL bit[maxn];LL sum(int i)

2017-08-27 10:21:54 288

原创 51nod1256 乘法逆元

#include <cstdio>#include <iostream>#include <cstring>#include <cmath>using namespace std;typedef long long LL;/*扩展欧几里得法(求ax + by = gcd)且|x|+|y|最小。其中d=gcd(a,b)*/LL gcd(LL a,LL b,LL &d,LL &x,LL

2017-08-27 10:09:24 212

原创 HDU6180 Schedule(贪心)

/*multiset+贪心有m个作业,一台机器在同一时间只能运行一个作业,已知每个作业的起始时间和结束时间,求出最少要多少个机器以及最少的机器总运行时间机器开始了就不会停,直到该机器不需要再作业 */#include <cstdio>#include <iostream>#include <set>#include <algorithm>using namespace std;

2017-08-26 16:47:30 248

原创 HDU6168 Numbers

/*map+模拟有n个数a[i],对于每对(i,j),1<=i<=j<=n,计算(a[i]+a[j])得到新的数列b[i],有m个数,m=n*(n+1)/2现已知b[i],求a[i]*/#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <map>using name

2017-08-25 17:27:14 162

原创 HDU6156 Palindrome Function(回文数)

#include <iostream>#include <cstdio>#include <algorithm>using namespace std;/*k进制下的回文数如果n在k进制下是回文数f(n,k)=k,否则f(n,k)=1n和k的变化范围为L<=n<=R,l<=k<=r,计算f(n,k)的累加和对于一个数,比如k进制下,从高位到地位表示为,456123k[]=321654、x

2017-08-25 11:29:47 266

原创 CSU1809 Parenthesis(前缀和+括号匹配)

/*线段树+前缀和+括号匹配题意:给定一个长度为n的”平衡”的括号序列。m次询问。每次询问,表示将第a个字符与第b个字符交换之后,是否依旧保持“平衡”。每次询问都是独立的。 按照原平衡的括号序列处理处前缀和, '('+1 ')'-1平衡的括号序列前缀和一定是>=01,s[a]==s[b] 平衡2,s[a]==')' s[b]=='(' 平衡3,s[a]=='(' s[b]=

2017-08-21 15:30:29 316

原创 CSU1803 2016(同余)

#include <iostream>#include <cstdio>#include <cstring>using namespace std;typedef long long LL;/*同余题意:求满足a * b 是 2016的倍数的对数, 1<= a <=n, 1<= b <=m;a[i]表示0-n之间的每个数对2016取余,余数为i的个数(a*b)%2016==(a%

2017-08-20 15:31:34 204

原创 HDU6154 CaoHaha's staff(递推+网格)

#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long LL;const int maxn=1e6+5;/*递推+网格题意:在笛卡尔坐标系下,画一个面积至少为n的简单多边形,每次只能画一条边或者一个格子的对角线,问至

2017-08-19 21:25:52 316

原创 HDU6129 Just do it(前缀异或+杨辉三角)

/*前缀异或+杨辉三角给定一个数组,求m次前缀和异或的结果Lucas定理,C(a,b)是奇数当且仅当把a,b二进制表达后b中1的位置是a中1的位置的子集如果对于两个数n、m,如果(n&m)==m,那么C(n,m)为奇数,否则为偶数。考虑第一个数对后面的贡献次数第一次: 1 0 0 0 0 第二次: 1 1 1 1 1 第三次: 1 2 3 4 5 第四次: 1 3 6 10 15第

2017-08-18 21:39:09 355

原创 HDU 6143 Killer Names(容斥+组合)

#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;/*容斥+组合有m个字符,两个长度为n的空串,要使两个长为n的空串填满,并且两个空串不出现相同的字符,问有多少种填法。*/typedef long long LL;const int mod=1

2017-08-17 20:42:08 183

原创 HDU6124 Euler theorem

#include <iostream>#include <cstdio>using namespace std;/*求一个数余数的个数*/int main(){ int T; int a; scanf("%d",&T); while(T--) { scanf("%d",&a); int ans=(a+1)/2+1;

2017-08-17 19:45:16 217

原创 HDU6053 TrickGCD(莫比乌斯函数)

#include<cstdio>#include<cstring>#include<algorithm>using namespace std;/*给定数列A,求解数列B有多少种数列B满足 1<=Bi<=Ai,且对于任意区间[l,r],gcd(Bl,Bl+1,...Br)>=2*/typedef long long LL;const int maxn=1e5+5;const in

2017-08-14 21:42:33 198

原创 51nod1181 质数中的质数(质数筛法)

/*素数筛如果一个质数,在质数列表中的编号也是质数,那么就称之为质数中的质数。如:3 5分别是排第2和第3的质数,所以他们是质数中的质数。。现在给出一个数N,求>=N的最小的质数中的质数是多少*/#include <iostream>#include <cstdio>#include <cstdio>#include <algorithm>using namespace std;co

2017-08-14 20:53:43 201

原创 51nod1242 斐波那契数列的第N项(矩阵)

#include<cstdio>#include<cstring>#include<iostream>const int mod=1e9+9;using namespace std;typedef long long LL;LL n;struct Matrix{ LL mat[2][2]; Matrix operator -(Matrix &tmp) {

2017-08-14 20:28:36 186

原创 HDU6103 Kirinriki(尺取)

#include <cstdio>#include <iostream>#include <cstring>#include <cmath>using namespace std;const int maxn=5e3+5;int m;char s[maxn];int main(){ int t; scanf("%d",&t); while(t--) {

2017-08-14 16:20:16 217

原创 HDU6119 小小粉丝度度熊(区间)

/*区间有n个区间,这n个区间内的天数,都签到了,m表示m张补签卡区间可能存在交叉的情况,求最多连续签到多少天*/#include <cstdio>#include <iostream>#include <algorithm>#include <cstring>using namespace std;typedef long long LL;int n,m;const int

2017-08-14 15:27:06 209

原创 HDU6114 Chess(组合数)

/*组合数在一共N×M个点的矩形棋盘中摆最多个数的車使其互不攻击的方案数对于任何一个車A,如果有其他一个車B在它的上方(車B行号小于車A),那么車A必须在車B的右边(車A列号大于車B)。ans=C(max(m,n),min(m,n))*/#include <cstdio>#include <iostream>#include <algorithm>#include <cstring>

2017-08-14 15:15:07 254

原创 HDU6097 Mindis(圆反演点)

#include <iostream>#include <cstdio>#include <cstring>#include <cmath>using namespace std;const double eps=1e-8;int sgn(double x){ if(fabs(x)<eps) return 0; if(x<0) return -1; else ret

2017-08-14 14:45:35 336

原创 HDU6113 度度熊的01世界(dfs)

#include <cstdio>#include <iostream>#include <cstring>using namespace std;/*搜索现在给你一个n*m的图像,你需要分辨他究竟是0,还是1,或者两者均不是。图像0的定义:存在1字符且1字符只能是由一个连通块组成,存在且仅存在一个由0字符组成的连通块完全被1所包围。图像1的定义:存在1字符且1字符只能是由一个连通块组成

2017-08-13 12:26:58 209

原创 HDU6112 今夕何夕(星期)

#include <cstdio>#include <iostream>#include <cstring>#include <algorithm>#include <cmath>using namespace std;/*接下来最近的哪一年里的同一个日子,和今天的星期数一样?比如今天是8月6日,星期日。下一个也是星期日的8月6日发生在2023年。在公历中,能被4整除但不能被100

2017-08-13 10:50:36 346

原创 HDU6108 小C的倍数问题(进制+唯一分解定理)

#include <cstdio>#include <iostream>#include <cstring>#include <algorithm>#include <cmath>using namespace std;const int maxn=1e6+5;/*唯一分解定理现在给定进制P,求有多少个B满足P进制下,一个正整数是B的倍数的充分必要条件是每一位加起来的和是B的倍数。

2017-08-13 10:44:30 209

原创 HDU6105 Gameia(博弈+图)

#include <iostream>#include <cstdio>#include <vector>#include <cstring>using namespace std;/*博弈+图给定一个树,对空节点进行染色,数有n个节点,根为1Bob有k次删边的机会,Bob选择一个空节点染色(黑色),他的儿子节点也会被染黑Alice可以任选一个空节点染色(白色) 如果有白色点则

2017-08-12 13:14:19 290

空空如也

空空如也

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

TA关注的人

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