上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 44 下一页
摘要: 搞了一下午,枚举顺序要注意....然后数据类型.... 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <queue> 5 #include <map> 6 #include <ctime> 7 #include <cmath> 8 #include <algorithm> 9 using namespace std;10 #define LL long long11 LL dp[1000001];1 阅读全文
posted @ 2013-05-22 17:17 Naix_x 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 比赛的时候,大体还是想出来了,有些细节没想好,虎哥提示了下,我写写代码,过了样例,就过了。。。智商拙计啊。。。看题看了好一会,才看懂题意,想了好一会,最后还没写出来。。。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <queue> 5 #include <map> 6 #include <ctime> 7 #include <cmath> 8 #include <algorithm> 9 usin 阅读全文
posted @ 2013-05-22 14:10 Naix_x 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 学习模拟退火,讲解看这里:http://www.cnblogs.com/heaad/archive/2010/12/20/1911614.html代码看的山大一个大神的博客:http://3214668848.blog.163.com/blog/static/48764919200991894621558/代码里就一个随机数,实现模拟退火算法的代码,比较好懂的。。。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: fence3 5 */ 6 #include <iostream> 7 #include <cstdio> 8 #include 阅读全文
posted @ 2013-05-22 10:48 Naix_x 阅读(200) 评论(0) 推荐(0) 编辑
摘要: DFS,1Y啊。。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: snail 5 */ 6 #include <iostream> 7 #include <cstdio> 8 #include <cstring> 9 #include <queue>10 #include <map>11 #include <cmath>12 #include <algorithm>13 using namespace std;14 int a[4] = {0,1,-1,0};15 int b[4] 阅读全文
posted @ 2013-05-20 10:50 Naix_x 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 先写了暴力,过了10+组,后来想了想,发现这个跟求最长公共子序有点相似啊。改改了状态转移,wa在第2组,然后注意了一下,包含的情况,乱改的一下,就过了。。。dp[i][j] 表示以i为结尾,j结尾最长的"主题" 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: theme 5 */ 6 #include <iostream> 7 #include <cstdio> 8 #include <cstring> 9 #include <queue>10 #include <map>11 #inc 阅读全文
posted @ 2013-05-20 09:37 Naix_x 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 把所有的连通块,左上角,右下角的坐标当作一个矩形存起来。然后枚举,跟之前的是不是相同。注意:连通块转化成矩阵的时候,只有一起连通的的点,在小的矩形里才为1,而不是str[i][j] =='1',这里错了次。。写的很麻烦。。 1 /* 2 ID:cuizhe 3 LANG: C++ 4 TASK: starry 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <iostream> 9 using namespace std; 10 struct node 11 { 12 int 阅读全文
posted @ 2013-05-19 16:36 Naix_x 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 注意传参的 类型。。。模版啊。。。 1 /* 2 ID:cuizhe 3 LANG: C++ 4 TASK: fc 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <queue>10 #include <iostream>11 #include <algorithm>12 using namespace std;13 #define eps 1e-614 struct Point15 {16 double x,y;17 阅读全文
posted @ 2013-05-17 16:50 Naix_x 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 终于结束了第4章。。倒数第二个题,卡了2个月。。。这个题,实现起来,还挺麻烦的,看懂题意,建好图,就是裸的拓扑排序了。 1 /* 2 ID:cuizhe 3 LANG: C++ 4 TASK: frameup 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <queue> 10 #include <iostream> 11 using namespace std; 12 int lx[30],ly[30],rx[30],ry[30] 阅读全文
posted @ 2013-05-17 10:39 Naix_x 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 第一二问,可以通过*1001+1,最后ans/1001 ans%1001来解决,第三问,看题解后完全无想法,然后找了一种水过的办法,水过了。。这种做法应该是错的。 1 /* 2 ID:cuizhe 3 LANG: C++ 4 TASK: milk6 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <queue>10 using namespace std;11 #define LL long long12 LL INF;13 LL flow[2 阅读全文
posted @ 2013-05-15 17:47 Naix_x 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 题目链接那场1个题就晋级的初赛,我当时搞A题,弄了一个多小时。。。这个DP,在各种瞎搞,修改之后,过了。。。 1 #include <cstdio> 2 #include <cstring> 3 #include <queue> 4 #include <map> 5 #include <iostream> 6 using namespace std; 7 #define INF 100000000 8 int dp[201][201]; 9 int t[101],z[101];10 int main()11 {12 13 int N, 阅读全文
posted @ 2013-05-08 19:26 Naix_x 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 题目链接我做的伤心了,不知是模版效率低,还是错了,交上就是TLE,找了份别人的代码,改了好几下终于过了。。 1 #include <cstdio> 2 #include <cstring> 3 #include <queue> 4 #include <map> 5 #include <iostream> 6 using namespace std; 7 #define INF 0x3fffffff 8 char food[201][201],drink[201][201]; 9 struct node 10 { 11 int u,v, 阅读全文
posted @ 2013-05-08 08:55 Naix_x 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 题目链接第一个二维的,注意一点如果num + 1 > w,num = w 这样就可以节约空间了,因为假如经过很多条边而且是最短路的话,无法存储。。 1 #include <cstdio> 2 #include <cstring> 3 #include <queue> 4 using namespace std; 5 #define INF 0x7fffffff 6 struct node 7 { 8 int u,v,next,w; 9 }edge[300001];10 int first[5001];11 int t,n;12 int dis[5001 阅读全文
posted @ 2013-05-06 20:44 Naix_x 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 题目链接数据范围较小,直接离散后暴力。等等学习一下线段树的思路。 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <algorithm> 5 using namespace std; 6 #define N 101 7 #define eps 1e-6 8 double xr[N],xc[N],yr[N],yc[N]; 9 double x[3*N],y[3*N];10 int dblcmp(double x)11 {12 if(fabs(x) < 阅读全文
posted @ 2013-04-24 15:44 Naix_x 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 题目链接此题挺裸的模版的,然后多组的判断,让我WA了很多次,用flag标记一下,就好。。。 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 #define N 60000 6 #define C_NUM 128 7 int trie[N][C_NUM]; 8 int o[N],fail[N],que[N],flag[N]; 9 int t,num; 10 void CL() 11 { 12 memset(trie,-1,sizeo 阅读全文
posted @ 2013-04-24 14:10 Naix_x 阅读(387) 评论(0) 推荐(0) 编辑
摘要: 题目链接这题在经过强哥讲解,看了很多题解之后AC了,矩阵乘法回顾了一下,然后AC自动机换了一份模版。。。慢慢理解。。 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<string> 5 using namespace std; 6 #define N 1000001 7 #define LL __int64 8 int t; 9 int tire[N][4]; 10 int que[N]; 11 int o[N]; 12 int fail[N]; 13 阅读全文
posted @ 2013-04-24 10:22 Naix_x 阅读(158) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 44 下一页