2011年8月15日

ACM PKU 2240 Arbitrage

摘要: 题目大意:http://poj.org/problem?id=2240一个人想利用兑换关系赚钱,给你几种兑换关系,要你求出这个人最开始有一美元,通过一连串的兑换看看最终是不是能赚到钱;问题转化为:先构图,单向图;然后求多源最短路径,只要G[i][i]>1.0的话就是赚钱了,意思就是给你一块钱,走一圈之后的钱比1块钱多就是赚钱了;找一个回路的最大值;这里Floyd求的肯定是最大值了,还有要注意的是double G[][],rate浮点型的; 1 #include <iostream> 2 #include <stdio.h> 3 #include <strin 阅读全文

posted @ 2011-08-15 17:09 _Clarence 阅读(105) 评论(0) 推荐(0) 编辑

ACM PKU 1062 昂贵的聘礼

摘要: 题目描述:http://poj.org/problem?id=1062所有给的测试数据都过了,就是一直wa,百思不得其解啊! 1 #include <iostream> 2 #include <string.h> 3 #include <stdio.h> 4 const int inf=1000000; 5 const int maxn=105; 6 using namespace std; 7 8 struct node 9 { 10 int weight,rank; 11 } point[maxn]; 12 13 int M,N; 14 int G[ma 阅读全文

posted @ 2011-08-15 09:52 _Clarence 阅读(142) 评论(0) 推荐(0) 编辑

导航