摘要: 题目大意:有n件湿的衣服,每件衣服都有相应的湿度,每分钟每件衣服的湿度减1(除了在烘干机里的衣服),现在有一个烘干机,烘干机一分钟可以让一件衣服的湿度降低k,问至少要花多少分钟才能使每件衣服的湿度为0 解题思路:贪心的话,每分钟都要使用到烘干机。 枚举时间,如果湿度小于等于时间的话,就不用... 阅读全文
posted @ 2016-04-21 14:41 _Mickey 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 题意: 给一张图,有墙,有路。问某人从起点开始,最多能走多少个格子。 思路: bfs; #include#includechar maze[25][25];int visit[25][25];int dir[4][2]={0,1,1,0,0,-1,-1,0};//方向int W,H,sum;vo... 阅读全文
posted @ 2016-04-21 14:02 _Mickey 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 1:给出n个字符串,输出每个字符串是第几个出现的字符串?多组数据 2:对每组数据,第一行输入n表示接下来有n个字符串 1 #include#include#includeusing namespace std;int main (){ int n; map m; char s... 阅读全文
posted @ 2016-04-20 10:06 _Mickey 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 给你n个整数,请按从大到小的顺序输出其中前m大的数。 每组测试数据有两行,第一行有两个数n,m(0 //sort也可以过//936Ms#include#include#includeusing namespace std;const int maxn=1000005;int ans[maxn... 阅读全文
posted @ 2016-04-16 12:39 _Mickey 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 枚举第一行所有可能的的情况 #include#include#include#includeusing namespace std;int map[6][7],maze[6][7],ans[6][7];int dir[5][2]={0,0,1,0,0,1,0,-1,-1,0};void pre... 阅读全文
posted @ 2016-04-09 09:04 _Mickey 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Description 把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。 Input 第一行是测试数据的数目t(0 using namespace std;int ans(int n,int ... 阅读全文
posted @ 2016-04-06 13:54 _Mickey 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 题意: 从一个坐标到另一个坐标的移动方式有三种,即:st-1,st+1,2*st。每移动一步时间是一秒。 给出两个坐标,求得从第一坐标到第二座标的最短时间。 #include#include#include#includeusing namespace std;const int maxn=1... 阅读全文
posted @ 2016-04-06 13:19 _Mickey 阅读(103) 评论(0) 推荐(0) 编辑
摘要: Description 某个地区有许多城镇,但并不是每个城镇都跟其他城镇有公路连接,且有公路的并不都能双向行驶。现在我们把这些城镇间的公路分布及允许的行驶方向告诉你,你需要编程解决通过公路是否可以从一个城镇到达另一个城镇。(我们规定,城镇自己跟自己可互相到达,即A可到达A). In... 阅读全文
posted @ 2016-04-05 16:14 _Mickey 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Description Bessie loves her grass and loves to hurry to the barn for her eveningmilking session. She has partitioned the pasture into a recti... 阅读全文
posted @ 2016-04-04 09:58 _Mickey 阅读(347) 评论(0) 推荐(0) 编辑
摘要: Description Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square? Input The first line of inpu... 阅读全文
posted @ 2016-04-04 08:55 _Mickey 阅读(124) 评论(0) 推荐(0) 编辑