上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 48 下一页
  2012年7月27日
摘要: http://poj.org/problem?id=1141着题的难点不在于动态规划 而在于输出其实想想也不难 DP 后根据最优解进行递归找需要匹配的括号就可以了代码及其注释:#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>#include<map>#include<queue>#include<cmath>#define LL long longusing namespace 阅读全文
posted @ 2012-07-27 08:20 夜-> 阅读(154) 评论(0) 推荐(0) 编辑
  2012年7月26日
摘要: http://poj.org/problem?id=3440简单题目 但是由于忽视了int越界 贡献了一次wa#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>#include<map>#include<queue>#include<cmath>#define LL long longusing namespace std;const double PI=acos(-1.0);in 阅读全文
posted @ 2012-07-26 20:34 夜-> 阅读(186) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4311思维呀 亲 你想到就可以做出来 想不到就做不出了 什么都不说了 上代码不知道为什么 在hdu 上 long long 和 int 相乘就让我错#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>#include<map>#include<queue>#include<cmath>#define 阅读全文
posted @ 2012-07-26 18:46 夜-> 阅读(248) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3071记忆化搜索代码及其注释:#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>#include<map>#include<cmath>#define LL long longusing namespace std;const int N=130;double win[N][N];//第几队 在第几次比赛中获胜的概率double beat[ 阅读全文
posted @ 2012-07-26 11:12 夜-> 阅读(151) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1222高斯消元#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<map>#include<cmath>#define LL long longusing namespace std;const int N=35;int lx[4]={1,-1,0,0};int ly[4]={0,0,1,-1};int a[N][N];int ans[N];int n;void G 阅读全文
posted @ 2012-07-26 10:01 夜-> 阅读(158) 评论(0) 推荐(0) 编辑
  2012年7月25日
摘要: http://poj.org/problem?id=1166#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<map>#include<cmath>#define LL long longusing namespace std;const int N=11;char pre[N][10]={"" ,"ABDE","ABC" ,"BCEF" 阅读全文
posted @ 2012-07-25 21:18 夜-> 阅读(184) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2947基础高斯消元 注意时刻模7#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<map>#include<cmath>#define LL long longusing namespace std;const int N=350;int a[N][N];int ans[N];int n,m;char s[9][5]={"","MON 阅读全文
posted @ 2012-07-25 19:10 夜-> 阅读(158) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1026找到每个循环 并记录循环里有多少个数对每个循环的字符进行移动 移动一次是一个循环 移动的次数 为循环里数的个数的余数代码:#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<map>#include<cmath>#define LL long longusing namespace std;const int N=205;int a[N];int num[N] 阅读全文
posted @ 2012-07-25 11:51 夜-> 阅读(184) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3270给n头牛 让你把他们升序排序 每次交换两个牛 交换花费是两个牛值之和求最小花费黑书上有 P248 求循环每个循环进行判断 一个循环的花费有两种情况可能为最优1 用循环内最小的花费牛 和其他牛 进行交换2 或是用全局最小花费牛 先和本环内最小花费牛交换 然后一样 最后再交换回来就可以了代码及其注释:#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<map>#include 阅读全文
posted @ 2012-07-25 10:40 夜-> 阅读(157) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2409#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<map>#include<cmath>#define LL long longusing namespace std;int gcd(int a,int b){ if(a%b==0) return b; return gcd(b,a%b);}LL ploya(int n,int m){ if(n==0) re 阅读全文
posted @ 2012-07-25 09:57 夜-> 阅读(153) 评论(0) 推荐(0) 编辑
上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 48 下一页