自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 codeforces 996b

#include <bits/stdc++.h>const int INF=0x3f3f3f;using namespace std;int a[100005];int main(){ int n,m; cin>>n; int MIN=2e9; int ans=0; for(int i=1;i<=n;i++) ...

2018-08-10 10:52:24 207

原创 codeforces 1004b

题意:要举办一个花展,花展上只能是玫瑰和百合两种花,给你n个位置,每个位置放这两种中的一种,给你,m个位置区间,每个区间有一个美丽值,是两种花个数的乘积,问所给区间美丽值的加和最大.在任何一个区间,都必须要有至少一个玫瑰和百合,否则,此区间的美丽值就会为零,要想区间和最大,穿插分布,是玫瑰和百合对半分,此时和最大.#include <bits/stdc++.h>using...

2018-08-10 09:36:06 222

原创 codeforces 1003c

#include <iostream>#include <cmath>#include <cstring>#include <cstdio>#include <algorithm>using namespace std;typedef long long ll;char str[]="01";int sum[5007];...

2018-08-09 18:30:28 211

原创 codeforces 909b

#include <bits/stdc++.h>using namespace std;typedef long long ll;int main(){ int a[5000]; memset(a,0,sizeof(a)); a[0]=0; a[1]=1; a[2]=2; a[3]=4; a[4]=6; in...

2018-08-09 18:28:11 208

原创 树状数组

转载:https://www.cnblogs.com/hsd-/p/6139376.htmlint lowbit(int t){ return t&(-t);}void add(int x,int y){ for(int i=x;i<=n;i+=lowbit(i)) tree[i]+=y;}int getsum(int x){ ...

2018-08-09 18:14:08 113

原创 codeforces 899B(字符串做法)

题意:给你一组每个月的天数,问你能否在现实中出现.解:可以利用字符串来做,即输入一行字符串,查询时候否是可能出现天数的子串.这时,大部分人可能会用什么高级算法,容易把问题复杂化,在学c语言初期,有一个函数,strstr();可以判断子串,用它就可以.要注意的是,出现的天数可能横跨3个年份,还必须考虑闰年,有四种可能分别是:平平闰,闰平平,平闰平,闰平闰.#include <...

2018-08-08 09:48:23 238

原创 codeforces 869B

题意:给你两个数a,b,求b的阶乘和a的阶乘之比的最后一位数字,即对10求余;注意如果在求余过程中余数为0,后面的余数就都为0,直接跳出,由于数据比较大,用同余定理来做.#include <bits/stdc++.h>using namespace std;typedef long long ll;vector<string> s;int main(){...

2018-08-04 10:45:23 214

原创 codeforces 877A

练习一下,容器vector和string类的用法;题意:字符串匹配,且只出现一次;#include <bits/stdc++.h>using namespace std;typedef long long ll;vector<string> s;int main(){ s.push_back("Danil"); s.push_back("O...

2018-08-04 10:17:26 229

原创 线段树

下面是以求所给区间和为例,而构建的线段树. #include <cmath>#include <cstring>#include <iostream>#include <cstdio>#include <algorithm>using namespace std;#define INFINITE 0x3f3f3fcon...

2018-08-03 08:43:35 132

原创 CodeForces - 1003D(练习一下map的用法)

Polycarp has nn coins, the value of the ii-th coin is aiai. It is guaranteed that all the values are integer powers of 22 (i.e. ai=2dai=2d for some non-negative integer number dd).Polycarp wants to...

2018-07-27 15:12:24 279

转载 最长公共子序列

最长公共子序列过程图解:转载    :  https://blog.csdn.net/hrn1216/article/details/51534607  

2018-07-26 16:19:02 129

原创 斯特林数

斯特林数有两大类,第一类:将n个不同元素构成m个圆排列的数目.1.对无符号整数:dp[i][j]=dp[i-1][j-1]+(i-1)*dp[i-1][j];2.对有符号整数:dp[i][j]=dp[i-1][j-1]-(i-1)dp[i-1][j];第二类:表示将n个不同的元素分成m个集合的方案数dp[i][j]=dp[i-1][j-1]+j*dp[i-1][j];具体原...

2018-07-26 15:45:29 276

原创 斯特林公式(近似求值)

斯特林近似值公式:lnn!=nlnn-n+0.5*ln2*pi*n;如果要求N的阶乘有几位,求log10n!+1;log10n!=lnn!/ln10.

2018-07-26 08:17:09 3881

原创 最长上升子序列

模板:#include<stdio.h>#include<algorithm>#include<cstring>using namespace std;int main(){ int n,num[100100],lis[100100],len; while(scanf("%d",&n)!=EOF) { ...

2018-07-25 20:09:02 141

原创 尺取

所谓的尺取,就是像尺子一样,在一段区域内,选取区间端点,通过控制下标的方法,一段一段的截取,poj3061题意:给定一个序列,找出最短的子序列长度,使其和大于或等于S解:首先,把两个端点的下标都赋值给给定序列的左端点,然后当所选定的端点区间的和小于S并且右端点的下标小于或等于给定序列的端点下标时,把右端点向后退进,如果当右端点的下标大于了序列右端点,并且其和仍然小于S,输出0;反之,当...

2018-07-18 14:49:47 240

空空如也

空空如也

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

TA关注的人

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