摘要: 这是一道求有没有负环的题,用到bellman算法;这里要注意的是路是双向的;View Code #include<iostream>#include<cstdio>#include<cstdlib>#include<algorithm>#include<cmath>using namespace std;class Weight{public: int S,E,T;}edge[5024];bool Bell_man( int count, int N ){ int dis[1024] = {0},flag = 0; for( int 阅读全文
posted @ 2012-06-30 20:47 wutaoKeen 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题意:就是货币兑换;问你经过几次兑换时候比原来的钱数是否多;N -货币种类, M - 兑换的方式, S -Nick拥有的币种 ,V - Nick该种币种的数值数;注意:货币的兑换可以循环使用多次;View Code #include<iostream>#include<cstdio>#include<cstdlib>#include<algorithm>#include<cmath>using namespace std;class Node{public: int num; double rate,com,sum; Node *ne 阅读全文
posted @ 2012-06-30 16:37 wutaoKeen 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 这个题是http://poj.org/problem?id=2996的反过来求的;这个题注意的就是建图;View Code #include<iostream>#include<cstdio>#include<cstdlib>#include<algorithm>#include<cmath>#include<queue>#include<set>#include<cstring>#include<vector>using namespace std;void Get_map( char 阅读全文
posted @ 2012-06-30 11:02 wutaoKeen 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 这是一道模拟题:要你找出黑白棋子的位置;注意要求;View Code #include<iostream>#include<cstdio>#include<cstdlib>#include<algorithm>#include<cmath>#include<queue>#include<set>#include<vector>using namespace std;void Research1( char c , char map[][35] ){ int i , j,flag=1; for( i 阅读全文
posted @ 2012-06-30 09:27 wutaoKeen 阅读(114) 评论(0) 推荐(0) 编辑