上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 44 下一页
摘要: 题目链接这题,没想出来,根本没想到用最小公倍数来更新,一直想状态压缩,不过余数什么的根本存不下,看的von学长的blog,比着写了写,就是模版改改,不过状态转移构造不出,怎么着,都做不出来。 1 #include 2 #include 3 #include 4 using namespace std; 5 #define LL __int64 6 #define MOD 2520 7 LL dp[31][2600][50]; 8 int index[3000]; 9 int num[31];10 LL gcd(LL a,LL b)11 {12 return b == 0?a:gc... 阅读全文
posted @ 2013-09-20 21:34 Naix_x 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 题目链接学习大神的数位DP模版。 1 #include 2 #include 3 #include 4 using namespace std; 5 int dp[31][31][31]; 6 int num[31]; 7 //dp[i][j][k] 代表前i位余数为j时候 flag的3种情况 8 int dfs(int pos,int pre,int flag,int bound)//pos代表位置,pre代表余数, 9 {10 int ans = 0,end,tflag,tpre,i;11 if(pos == -1)//flag 1代表上位是1,2代表前面已经有13了... 阅读全文
posted @ 2013-09-18 14:30 Naix_x 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 题目链接 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define N 1001 8 #define M 20000001 9 #define INF 0x3f3f3f3f 10 struct node 11 { 12 int u,v,next; 13 }edge[M]; 14 int first[N],DFN[N],Belong[N],stack[N],Low[N],cnum[N]; 15 int in[N],d[N]; 16 int qu... 阅读全文
posted @ 2013-09-17 11:52 Naix_x 阅读(942) 评论(0) 推荐(0) 编辑
摘要: 表示第一次在div1,我要记录一下...木有挂0,第一题不怎么难的,读题读了20分钟,又想了20分钟,时间有点长,然后各种小心,然后得了140分....后两个题,根本木有看,貌似做出来的也不多。。。涨了6分。。。这。。。我的成绩很稳定,一直都是一个题。。。贴了代码,填充一下内容。。。第一题:class TheTree{public: int maximumDiameter(vector cnt) { int i,j,n,temp,maxz; int p[101]; n = 0; maxz = 0; for(it... 阅读全文
posted @ 2013-09-17 10:56 Naix_x 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 题目链接这其实入门题,不过,我写了好一会,还是一直wa,图样。。。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 int dp[11][11],sum[11];12 int judge(int x)13 {14 int num[11],i,j,n = 0,pre;15 int ans = 0;16 if(x == 0)17 return 1;18 ... 阅读全文
posted @ 2013-09-17 08:54 Naix_x 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 题目链接抄的模版。。。mark一下。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 #define eps 1e-10 9 #define zero(x) (((x) > 0?(x):(-x)) < eps) 10 struct point3 11 { 12 double x,y,z; 13 }; 14 struct line3 15 { 16 point3 a,b; 17 }; 18 struct plane3 ... 阅读全文
posted @ 2013-09-15 21:15 Naix_x 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 题目链接脑子有点乱,有的地方写错了,尚大婶鄙视了。。。来个模版的。 1 #include 2 #include 3 #include 4 using namespace std; 5 #define LL __int64 6 LL dp[31][31]; 7 int num[31]; 8 LL dfs(int pos,int pre,int bound) 9 {10 int end,tpre,i;11 LL ans = 0;12 if(pos == -1)13 return pre == 0;14 if(!bound&&dp[pos][pre] !... 阅读全文
posted @ 2013-09-11 21:23 Naix_x 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题目链接我用的比较传统的办法。。。单调队列优化了一下,写的有点搓,不管怎样过了。。。两个单调队列,存两个东西,预处理一个标记数组存。。。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 #define INF 100000011 char str[200000];12 int dp[200000];13 int pre[200000];14 int que1[200000];15 int que2[20... 阅读全文
posted @ 2013-09-11 18:52 Naix_x 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 题目链接这题挺水,看懂了,就OK。卡了几下内存,还是卡过了。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 #define N 140311 int r[N][N][2],c[N][N][2];12 int r1[N][N][2],c1[N][N][2];13 char str[N][N];14 int main()15 {16 int i,j,n,t;17 scanf("%d",&n.. 阅读全文
posted @ 2013-09-11 11:29 Naix_x 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 题目链接以前做过的一题,URAL数据强点,优化了一下。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 int dp[1001][11];11 int dfs(int n,int m)12 {13 int i,temp,ans;14 if(dp[n][m] > 0)15 return dp[n][m];16 if(m == 1)17 return n;18 ... 阅读全文
posted @ 2013-09-11 09:56 Naix_x 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 题目链接本来暴力写个TLE了,加上记忆化就A了。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 int pre[1001][1001]; 9 int flag[1001][1001];10 char s1[1001],s2[1001];11 int sum1[1001],sum2[1001];12 int n;13 int que[3001];14 int dfs(int x,int y)15 {16 if(x == n&&y == n)1.. 阅读全文
posted @ 2013-09-10 21:48 Naix_x 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 题目链接这破题,根本看不懂题意啊。。。题意:一棵中序遍历是1 2 3 4 5...的满二叉树,从a a+1 a+2 a+3 b,总共多少步。x到y的距离为中间有多少个点。a > b没注意2Y。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 int bin[60];10 int judge(int x)11 {12 int i,temp;13 if(x = 0;i --)16 {17 i... 阅读全文
posted @ 2013-09-10 17:03 Naix_x 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 题目链接错误的贪了一下,然后D了两下就过了。注意是不上升和不下降。。不是上升和下降。。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 #define INF 10000000010 int p[200001];11 int dp[200001];12 int o1[200001];13 int o2[200001];14 int main()15 {16 int a,b,i,n;17 scanf("%d%d"... 阅读全文
posted @ 2013-09-10 12:05 Naix_x 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 题目链接这题不难啊。。。标记一下就行了。表示啥想法也没有。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 #define INF 10000000010 int dp[100001];11 int flag[100001];12 int p[101];13 int o[101];14 int que[101];15 int pre[100001];16 int main()17 {18 int i,j,n,m;19 ... 阅读全文
posted @ 2013-09-09 21:40 Naix_x 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 题目链接2了,差点就A了。。。这题真心不难,开始想的就是暴力spfa就可以,直接来了一次询问,就来一次的那种,TLE了,想了想,存到栈里会更快,交又TLE了。。无奈C又被cha了,我忙着看C去了。。。这题,是我一个地方写错了。。top = 0的时候会死循环吗?貌似不会把,反正我加了这个判断,就A了,可能优化了一下把。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 #define INF 100000010 int first... 阅读全文
posted @ 2013-09-09 16:12 Naix_x 阅读(249) 评论(4) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 44 下一页