上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 71 下一页
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4669这题各种错误都来了一遍 预处理一下第一个数作为尾数与相邻前面的数组成的数的余数 然后再与后面的结合求余数9 6 4 2 8 因为是个环 可以 9 6 4 2 8 9 6 4 2 8 组合 不过 又不能超N所以先预处理 89 289 4289 64289 的余数 再与后面的组合 删除重复的 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define N 50005 7 #define LL __int64 8 . 阅读全文
posted @ 2013-08-14 17:03 _雨 阅读(199) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4632TLE了N次 原因居然是取模次数太多了。。! 这数据卡的好紧 还是我写的太搓。。828ms挤过s[i]==s[j]dp[i][j] = dp[i][j-1]+dp[i+1][j]+1;else dp[i][j] = dp[i][j-1]+d[[i+1][j]-dp[i+1][j-1]; 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define mod 10007 7 char s[1010]; 8 int . 阅读全文
posted @ 2013-08-14 14:06 _雨 阅读(252) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4671这个高端的题意啊 看了N久啊n>m时 直接第一列按顺序来 第二列为M+1else 第一列顺序来 第二列 按第一组为N 第二组为N-1 依次分配 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define N 110 8 int f[110][110],a[110][110],x[110]; 9 int main()10 {11 int i,j,k,n,m;12 while... 阅读全文
posted @ 2013-08-14 10:39 _雨 阅读(195) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4666先看一个求曼哈顿的帖子http://www.cnblogs.com/lmnx/articles/2479747.html然后用mulityset进行维护下就可以了 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 #define N 60010 9 int w[N][10];10 int main()11 {12 int i,j,q,g,k;13 whil... 阅读全文
posted @ 2013-08-14 10:02 _雨 阅读(197) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4526额。。七夕快乐哦刚推的时候有点乱 又各种小错误 查了好久。。dp[i][k] = min(dp[i-1][g]+g*t+d,dp[i][k]){(g-k) 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define INF 0xfffffff 8 int ca[111][2],dp[110][110]; 9 int main()10 {11 int t,g,i,j,k,n,s,d;12 cin>... 阅读全文
posted @ 2013-08-13 01:27 _雨 阅读(295) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4323去年的多校 编辑距离的变形 暴力居然过了 还想了好久别的方法,想得很头疼 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int dp[12][12],kk[1510],num[1010]; 8 char s[1510][12],ss[12]; 9 int main()10 {11 int i,j,k,n,m,t,a,b,o=0,g;12 scanf("%d",&t 阅读全文
posted @ 2013-08-12 19:39 _雨 阅读(199) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4374去年多校的题 今年才做 不知道这一年都干嘛去了。。DP的思路很好想 dp[i][j] = max(dp[i-1][g]+sum[i][j]-sum[i][g-1],dp[i][j]) abs(g-j) 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define N 105 8 #define M 10005 9 #define LL __int6410 int a[N][M],que[M];11 int dp[ 阅读全文
posted @ 2013-08-12 14:33 _雨 阅读(337) 评论(1) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1838其实原先不知道这题是DP 我都想不到DP去想了想没思路 看了下题解 经典思路 :第n大的都是由第n-1大的推出来的记录以a(i,j)为右下端所能构成的最大棋盘 若a[i-1][j]和a[i][j-1]都与它不同 而且a[i-1][j-1]与它相同 则dp[i][j] = min(dp[i-1][j],dp[i][j-1],dp[i-1][j-1])+1 之所以是最小 是因为它要保证能全部构成 如:1011010110100101dp[4][4] 如果可以由dp[3][3]推的话 就错了 应该是由dp[3 阅读全文
posted @ 2013-08-11 22:26 _雨 阅读(209) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1088据说这题叫经典记忆化搜索 瞎写了下就过了 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define INF 0xfffffff 8 int a[110][110],dp[110][110]; 9 int find(int i,int j)10 {11 if(dp[i][j])12 return dp[i][j];13 int x=0,y=0,z=0,o=0;14 if(a[i][j]>... 阅读全文
posted @ 2013-08-11 20:33 _雨 阅读(225) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2229挺好的一公式。。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define N 1000010 8 #define mod 1000000000 9 long long dp[N];10 int a[N];11 int main()12 {13 int i,j,k,n;14 while(cin>>n)15 {16 memset(dp,0,sizeof(dp));17 ... 阅读全文
posted @ 2013-08-11 17:45 _雨 阅读(184) 评论(0) 推荐(0) 编辑
上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 71 下一页