自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(119)
  • 资源 (1)
  • 收藏
  • 关注

原创 Codeword codeforces 666c

/*不会做f[i][j] = f[i][j]* 26 + 25^(j-i)*C(i-1)(j-1)C(i-1)(j-1) 对应j-1最早出现的位置 1、答案只和字符串长度有关。2、最多不同的字符串长度只有(k+1)*k/2 = sum , k = sqrt(2*sum) 代码参考 @ftiasch大神的 */#include#include#include#include

2016-05-04 01:46:32 821 1

原创 FZU ~APTX4869

#include#include#include#includeusing namespace std;/*二分答案+并查集判定 http://acm.fzu.edu.cn/contest/problem.php?cid=151&sortid=5*/ const int maxn = 805;int mx[maxn][maxn];int flag[maxn];int fat

2016-05-03 02:09:47 543

转载 HDU 5208

int dp[pos][l1][r1][l2][r2]; l1,r1,l2,r2 状态都是0,1表示是否达到边界状态

2015-05-20 00:00:02 601

原创 隐藏信息 codeforces div1 506 A

import java.util.Scanner;//一道题的成败在于你能挖掘多少题目隐藏信息//http://codeforces.com/blog/entry/15889/* * d + (d + 1) + (d + 2) + ... + (d + 245) ≥ 1 + 2 + ... + 245 = 245·(245 + 1) / 2 = 30135 > 30000. * Th

2015-01-22 02:02:46 854

原创 Face The Right Way POJ 3276

import java.util.Scanner;//http://poj.org/problem?id=3276//从边界开始考虑+前缀和优化利用奇偶性public class Main { public static int[] face; public static int MAX_LENGTH = 5005; static { face = new int[MAX_

2015-01-20 23:35:40 615

转载 Jessica's Reading Problem POJ 3320

#include#include#includeusing namespace std;const int MAX_P = 1000005;int a[MAX_P];int min(int a,int b){ return a<b?a:b;}int main(){ int p; int i, j ; while(scanf("%d",&p)!=EOF){ se

2015-01-20 01:19:29 590

原创 hdu Select 5101

import java.util.Arrays;import java.util.Scanner;//求反面public class Main { public static int MAX_LENGTH = 1001; public static int[] v; public static int[] iq; static { v = new int[MAX_LE

2015-01-18 21:34:50 682

原创 Harry And Magic Box

import java.util.Scanner;//http://acm.hdu.edu.cn/showproblem.php?pid=5155public class Main { public static int[][] c; public static int[] bi; public static int len = 55; public static int mod

2015-01-17 02:02:53 701

转载 js的Prototype属性 解释及常用方法

js的Prototype属性 解释及常用方法 (2011-03-11 23:28:14)转载▼标签: 杂谈分类: Jsp/页面管理类函数:原型每一个构造函数都有一个属性叫做原型(prototype,下面都不再翻译,使用其原文)。这个属性非常有用:为一个特定类声明通用的变量或者函数。prototy

2014-07-14 21:01:59 724

转载 http://codeforces.com/contest/432/problem/D

#include#includeconst int maxn = 100005;char s[maxn];int cnt[maxn];int next[maxn];int ansk;int ans1[maxn];int ans2[maxn];void get_next(int len) { int i=0,j=-1; next[0]=-1; f

2014-06-16 23:03:02 694

原创 Quad Tiling

#include#include#includeusing namespace std;typedef __int64 lld;const int maxn =1005;const int maxm =1005;int n , m;int mod;struct Matrix{ int n,m; int a[1<<5][1<<5];//a[maxn][maxm]会错 不懂

2014-04-17 21:16:40 695

翻译 Codeforces D. Points

/*http://blog.csdn.net/acm_cxlove/article/details/8900107线段树维护x轴上y的最大值 ,set存储每一个x上y的集合确定在哪一维上后,利用set二分*/#include#include#include#includeusing namespace std;const int maxn = 200005;int n,

2013-08-17 20:56:42 680

翻译 [POJ 2104]K-th Number (不带修改的区间k大,函数式线段树)

/*http://hi.baidu.com/wyl8899/item/e00796a9cb2df73d020a4d68*/#include#include#includeusing namespace std;const int MAX_N=100005;const int MAX_M=5005;const int MAX=MAX_M*600;int n,m;int

2013-08-13 21:32:54 793

原创 POJ Crosses and Crosses

#include#includeconst int maxn=2005;int n;int vis[maxn];int SG[maxn];int Gao(int x){ int i,j,k; if(SG[x]!=-1)return SG[x]; memset(vis,0,sizeof(vis)); for(i=1;i<=x-5-i;i++){ k=Gao(i)^Gao(

2013-07-29 18:11:11 809

转载 hdu 4559 涂色游戏

/*http://hi.baidu.com/chenwenwen0210/item/00cb739a43e8516bf14215ebhttp://www.cnblogs.com/kuangbin/archive/2013/05/24/3097767.html */#include#includeconst int maxn=5000;int SG[maxn];int n,m;

2013-07-28 20:12:07 1100

原创 CD操作

#include#include#include#include#include#include#includeusing namespace std;typedef __int64 lld;const int maxn=100005;int n,m;int dp[maxn][18];vectoredge[maxn];mapmp;string s1,s2;int

2013-05-17 21:43:28 934

转载 HDU Substrings

#include#includeconst int maxn=1000005;typedef __int64 lld;lld dp[maxn];int dis[maxn];int mp[maxn];int a[maxn];int h[maxn];int flag[maxn];/*初始状态很好看DP[1]=N;DP[I]表示长度为i的可能把没一个dp状态的情况列出来,看如

2013-05-14 11:31:43 729

转载 湫秋系列故事——安排座位

//http://blog.csdn.net/fangkyo/article/details/8752808#include#includetypedef __int64 lld;const int mod=1000000007;const int maxn=500;lld C[maxn][maxn];lld dp[50][maxn];/*dp[m][i]为前0~m个系的同学排

2013-05-13 11:40:09 843

转载 吉哥系列故事——恨7不成妻

/*http://hi.baidu.com/longmenwaideyu/item/0fc75b2897e0430276272c85*/#includetypedef __int64 lld;const int mod=1000000007;struct Node{ lld s,n,sq; Node(lld a=0,lld b=0,lld c=0):s(a),n(b),sq

2013-05-12 12:39:01 917

原创 PKU A Simple Problem with Integers

/*sum[x] x为根的和add[x] x的子树的懒的标记val[x] x节点的值 */#include#include#include#define KeyTree (ch[ch[root][1]][0])using namespace std;const int maxn =300005;typedef __int64 lld;lld v[maxn];str

2013-04-17 11:10:39 698

原创 HDU Robotic Sort

/*我们要如何知道每次该旋转哪个block呢?即便我们知道该旋转哪个block,那这个block在splay中又处于哪个位置呢?对于第一个问题,我们可以先将block排个序,这样自然就知道每次该旋转哪个block了。对于第二个问题,我们可以在建树的过程中把每个block所在的节点的标号存下来即可。——————————————(转自http://www.cnblogs.com/stagin

2013-04-17 10:13:06 863

原创 Edge Case ZSTU

import java.util.Arrays;import java.util.Scanner;import java.math.*;public class Main{ int n; BigInteger dp[][]=new BigInteger [10005][2]; BigInteger ans=new BigInteger("0"); void init(){

2013-04-16 17:39:18 808

转载 Double Queue POJ 3481

//http://blog.csdn.net/fp_hzq/article/details/6887058#include#include#include#includeusing namespace std; const int maxn=2000005; int L[maxn],R[maxn],S[maxn],V[maxn],K[maxn]; int cnt_node,r

2013-04-12 11:24:37 704

转载 NOI2004 郁闷的出纳员

//http://www.lydsy.com/JudgeOnline/problem.php?id=1503//http://blog.csdn.net/fp_hzq/article/details/6882519#include#include#includeusing namespace std; const int maxn=2000005; int L[maxn],R[m

2013-04-07 12:55:25 792

转载 [HNOI2002]营业额统计

/*http://www.lydsy.com/JudgeOnline/problem.php?id=1588*/#include#include#includeusing namespace std;const int maxn=2000005;int L[maxn],R[maxn],S[maxn],V[maxn];int n,p[maxn];int cnt_node,ro

2013-04-06 10:56:48 678

转载 HDU 3473 Minimum Sum

#include#includeusing namespace std;typedef __int64 lld;#define M 100005#define md(x,y) (((x)+(y))>>1)int sorted[M];struct node{ int val[M];// val记录第k层当前位置的元素的值 int num[M];// num记录元素所在区间的当

2013-04-01 11:25:20 641

转载 Playlist codeforces 268E

1.Consider any two songs which are at positions i and j (i . If Manao liked song i and disliked song j, then song i will be listened to again. Therefore, with probability p[i]*(1-p[j]) the process

2013-03-28 21:23:39 994

原创 Three Horses

http://www.codeforces.com/contest/271/problem/E1、三个公式,显然不能独立运用,公式1显然不是让你一个一个加,显然公式1和公式2可以结合2、统计时小心重复

2013-03-26 21:50:46 946

原创 SRM 572 div2 1000

/*注意dp的for循环,状态之间的重复计算dp[i][j]表示i种不同的余数的和为j的方法树 */#include#includetypedef long long lld;const int mod=1000000007;lld dp[52][1300];lld fac[52];class DistinctRemainders{public: lld Bin(

2013-03-21 09:41:47 1032

原创 New Year Garland

#include#includetypedef __int64 lld;const int maxn=5005;const int M=1000005;lld d[2][maxn];lld dp[maxn][maxn];lld sum;int l[M];lld f1[maxn],f2[maxn];int n,m,mod;/*3 2 10003 1 22 3 1000

2012-11-08 10:40:42 651

原创 Little Elephant and Strings CF204E 注意何时线段树update()

#include#include#includeusing namespace std;typedef __int64 lld;const int maxn=200005;//以下为倍增算法求后缀数组int wa[maxn],wb[maxn],wv[maxn],Ws[maxn];int cmp(int *r,int a,int b,int l){return r[a]==r[

2012-11-06 16:12:28 851

转载 CF 19C 后缀数组O(1)判Repeats ,优先队列模拟操作+map离散

#include #include #include #include#include#includeusing namespace std; const int maxn=100005; //以下为倍增算法求后缀数组 int wa[maxn],wb[maxn],wv[maxn],Ws[maxn]; int cmp(int *r,int a,int b

2012-11-05 16:46:01 745

原创 B. Petr# 113B Tire去重

#include#includeconst int MM = 2000050,M1 = 26;const int maxn=2005;int N,L;int lc,ls,lt;int fs[maxn],ft[maxn];int ans;char ch[maxn],s[maxn],t[maxn];struct node{ int sign; int vis;

2012-11-01 21:15:53 1046

原创 String CF 128B 第k大子串

#include #include #include using namespace std; typedef __int64 lld;const int maxn=200005; //以下为倍增算法求后缀数组 int wa[maxn],wb[maxn],wv[maxn],Ws[maxn]; int cmp(int *r,int a,int b,i

2012-11-01 19:32:43 1512

原创 A Sequence of Numbers HDU

/*求2^t<=(x+d)mod 2^(t+1)<2^(t+1)的x个数分类 当 2^t<=x+d<2^(t+1) 和2^t+2^(t+1)<=(x+d)<2^(t+2)两类(转http://blog.sina.com.cn/s/blog_82061db90100uq0d.html)题意是给以一串短整数,然后有一连串的操作,分别为1.把所有的整数都加上某一个值,如果大于2^16-1就取

2012-10-29 17:27:35 621

原创 HDU str2int 前缀和的力量

#include#include#includeusing namespace std;const int maxn=200050;const int mod=2012;//以下为倍增算法求后缀数组int wa[maxn],wb[maxn],wv[maxn],Ws[maxn];int cmp(int *r,int a,int b,int l){return r[a]==r[b

2012-10-28 21:00:34 2832

原创 Mahjong HDU 4431

#include#include#includeusing namespace std;const int M=34;char ch[35][5]={"1m","2m","3m","4m","5m","6m","7m","8m","9m", "1s","2s","3s","4s","5s","6s","7s","8s","9s", "1p","2p","3p","4p"

2012-10-27 15:28:25 900

原创 Partial Teacher 67A

#include#includeconst int INF=10000006;const int maxn=1005;char ch[maxn];int pre[maxn][maxn];int dp[maxn][maxn];int M1[maxn],id[maxn];int n;void init(){ for(int i=0;i<maxn;i++) for(int j

2012-10-26 23:17:50 720

原创 HDU locker 4433

#include#includeusing namespace std;const int maxn=1005;const int INF=1000000;char s[maxn],t[maxn];int dp[maxn][11][11];//dp[i][j][k]表示前i位,第i位状态为j,i+1状态为k//前i-1位对第i位的影响最多为 第i位,第i+1位只要记录前i-1对第

2012-10-26 15:52:56 1274

原创 CF 214D

#include#includetypedef __int64 lld;const int mod=1000000007;const int maxn=105;int n;int a[55];lld C[maxn][maxn];void init(){ int i,j,k; for(i=0;i<maxn;i++) C[i][0]=C[i][i]=1; for(i=2;

2012-10-26 15:13:24 597

空空如也

空空如也

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

TA关注的人

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