摘要: A -Macaw Baby Learns ComputerTime Limit:1000MSMemory Limit:0KB64bit IO Format:%lld & %lluSubmitStatusDescriptionProblem FMacaW Baby Learns ComputerThe newborn Macaw baby is learning computer now. But as the Macaw dad cannot afford much so he has bought a computer that supports only floating-poin 阅读全文
posted @ 2014-03-01 16:13 来自大山深处的菜鸟 阅读(232) 评论(0) 推荐(0) 编辑
摘要: /* 2月28 从这题中可以很明显的看出我的粗心 ,第一个表示的是 第一个事件在第几个顺序发生 而我确认为 他说的是 第一个表示的是第几个事件发生 这题理解了这里就不难了 LIS 。。。 */#include#include #include using namespace std;int N[2][25];int A[2][25];int main(){ int n ,d; scanf("%d",&n); for(int i=1;iN[d^1][j]?N[d][j-1]:N[d^1][j]; } } pri... 阅读全文
posted @ 2014-02-28 22:43 来自大山深处的菜鸟 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 有点坑 在他这里 0不算一位数#include #include #include using namespace std;const int maxn=1005;const int mod=1000000007;long long dp[maxn][maxn];int main(){ int n,m; while(scanf("%d%d",&n,&m)==2){ for(int i=0;i<n;i++) dp[1][i]=1; for(int i=2;i<=m;i++){ for(int j=0;j<n;j++... 阅读全文
posted @ 2014-02-26 21:12 来自大山深处的菜鸟 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 简单 最小生成树 将变转化为 Li=2*Li+Si+EI 因为那个人还要走回来 这样变化就能够计算出 来回要花费的时间 然后进行一次最小生成树#include #include #include #include using namespace std;const int maxn=10005;const int maxm=100005;struct edge{ int x,y; long long W;}E[maxm];int F[maxn];long long N[maxn],maxv;int father(int a){ return a==F[a]?a:F[a]=father(F[.. 阅读全文
posted @ 2014-02-26 20:17 来自大山深处的菜鸟 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 简单的 树形动态规划#include #include #include #include using namespace std;const int maxn=100005;vectorV[maxn];int Num[maxn],ans[maxn][2];int maxv(int a,int b){ return a>b?a:b;}void dp(int L,int G){ int tv; for(int i=0;ians[tv][1]?ans[tv][0]:ans[tv][1]); } }}int main(){ int n; w... 阅读全文
posted @ 2014-02-26 20:13 来自大山深处的菜鸟 阅读(178) 评论(0) 推荐(0) 编辑
摘要: http://acm.sgu.ru/problem.php?contest=0&problem=397 模拟链表 ,坑惨了我 ,自己模拟链表 出错 wa了 好久#include#includeconst int maxn=1000005;char str[maxn],T[maxn];int per[maxn],next[maxn];int main(){ int n; while(scanf("%s",str)==1){ n=strlen(str); int S=0,L=0;per[0]=next[0]=-1; for(int i... 阅读全文
posted @ 2014-02-24 18:24 来自大山深处的菜鸟 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 这题wa 了 八次 你说 巨弱 orz 大神 总结一下 没有将所有的情况考虑清楚 ,当有的时候一个人已经全部看完的时候 别的人还没开始 但是我就把他给结束了#include #include#includeusing namespace std;const int maxn=1100;struct point{ long long ti; int num; bool operator a.ti||(ti==a.ti&&num>a.num); }};priority_queue doc[maxn];queuepat[maxn];int main(){ int t; ... 阅读全文
posted @ 2014-02-19 19:27 来自大山深处的菜鸟 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 境界一、 暴力广搜+STL 开始的时候,自然考虑用最直观的广搜,因为状态最多不超过40万,计算机还是可以接受的,由于广搜需要记录状态,并且需要判重,所以可以每次图的状态转换为一个字符串,然后存储在stl中的容器set中,通过set的特殊功能进行判重,由于set的内部实现是红黑树,每次插入或者查找的复杂度为Log(n),所以,如果整个算法遍历了所有状态,所需要的复杂度为n*Log(n),在百万左右,可以被计算机接受,由于对string操作比较费时,加上stl全面性导致 速度不够快,所以计算比较费时,这样的代码只能保证在10秒内解决任何问题。但,明显效率不够高。POJ上要求是1秒,无法通过,第一. 阅读全文
posted @ 2014-01-17 11:35 来自大山深处的菜鸟 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 这题说的是 一辆汽车 每走一单位的距离就消耗一单位的燃料,然后,他要回城里去,当然他与城镇之间有n个加油站 ,他的油箱可以为 无穷大 ,这样分析后发现进不进汽油站 与 汽油站在哪无关 ,只与加油站的 汽油有关 (当然是他能到达的加油站)然后直接贪心#include#include#include#include#includeusing namespace std;struct point { int dist,pow,num; bool operator b.dist) return true; else return false;}bool mark[100005];in... 阅读全文
posted @ 2014-01-12 10:55 来自大山深处的菜鸟 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 概率DP主要用于求解期望、概率等题目。转移方程有时候比较灵活。一般求概率是正推,求期望是逆推。通过题目可以体会到这点。首先先推荐几篇参考的论文:《信息学竞赛中概率问题求解初探》《浅析竞赛中一类数学期望问题的解决方法》《有关概率和期望问题的研究 》1、POJ 3744 2、POJ 2096 Collecting Bugs3、ZOJ 3329One Person Game4、HDU 4405Aeroplane chess5、HDU 4089 Activation6、HDU 4035 Maze7、HDU 3853 LOOPS8、POJ 2151 Check the difficulty of pro 阅读全文
posted @ 2014-01-09 17:25 来自大山深处的菜鸟 阅读(158) 评论(0) 推荐(0) 编辑