- 博客(9)
- 收藏
- 关注
原创 poj 1276Cash Machine
0/1背包问题,动态规划求解即可。#include#includeusing namespace std;int main(){ queue q; int cash,N,num[1005],deno[1005],tmp; bool able[100005]
2011-08-03 22:47:39 235
原创 poj 3083Children of the Candy Corn
一道搜索题目,虽然挺简单,但很繁琐,在方向上纠结了好长时间。还好最后一遍AC。#include#includeusing namespace std;int s_right(int dir,int tmpx,int tmpy);int s_left(int d
2011-08-02 22:56:46 272
原创 poj 2965The Pilots Brothers' refrigerator
下面这个方法不是我原创的.....我用了枚举的办法,本地运行几乎不花时间,交上去就TLE,实在是太诡异了..........关于这个方法的说明,我觉得还是贴一下人家的原文吧。#includeusing namespace std;int main(){ char ch
2011-07-24 21:49:43 283
原创 poj 1797Heavy Transportation
和dij求最短路径有异曲同工之妙吧,类比一下就好了,还wrong answer了3次,泪奔..#include#includeusing namespace std;const int INF=9999999;int Dij(int n);int wei[1001][1
2011-07-24 14:55:36 287
原创 poj 1852Ants
初看起来还懵了一下,其实就以一个等效思想在里面,两只蚂蚁碰头并向相反的方向运动,其实就等效于蚂蚁之间“穿越”了,所以就相当于n只蚂蚁在n根木棍上独立的运动,问题一下子就很简单了............不明白为什么不支持abs(int)在这个函数,我只好重写了一个。#include
2011-07-24 10:47:06 253
原创 poj 3254约瑟夫问题(队列实现)
感觉这道题的做法有很多,当然,这道题很简单啦~~数组模拟、链表都是可行的办法,今天预习队列,突然觉得队列也是可以方便求解的(个人是有点弱~~初学者~~),废话不多说了,直接上代码。#include#includeusing namespace std;int main
2011-07-19 14:02:25 442
原创 poj2485 Highways
#include#include#includeusing namespace std;int main(){ int t,n,Max,path[501][501],num; bool visited[501]; scanf("%d",&t); f
2011-07-19 09:38:57 246
原创 poj1062 昂贵的婚礼
总体来说还是一道挺水的题,设想一个假想的0点,0点到个商品的距离即直接购买商品的价格,这样就转化为了搜索最短路径的问题,再根据等级制度进行枚举即可~~//It is a simple problem about searching#include#include//H
2011-07-19 09:37:57 347
原创 poj 1125Stockbroker Grapevine水题Floyd算法
#include<iostream>using namespace std;const int MAX=20;int main(){ int t,n,num,tmp_time,tmp_min,time[101][101],Min,Order
2011-07-19 09:35:49 289
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人