hdu1050】的更多相关文章

Moving Tables Time Limit: 1000MS Memory Limit: 10000K Total Submissions: Accepted: Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has rooms each on the n…
囧 . 想了好久,一开始想的是一个连通图怎样用黑白两色染色,想了各种算法发现都不好做,然后灵机一动这不是网路流吗,然后想怎么建图,如果转换成网络流这题就好做了,建图加个二分应该就可以解决了,最后又发现好像只要找出哪段走廊被用过得次数最多就行了... 这么简单的题却想了这么久. 不过用了网络流的方法想这题的这种贪心就好解释了. hdu 1050 #include <iostream> #include <stdio.h> #include <string.h> #incl…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1050 求区间上点的最大重叠次数. #include <stdio.h> #include <string.h> int main() { int t, s, e, i, n, max, tmp; int mark[205]; scanf("%d", &t); while (t--) { scanf("%d", &n); memset(…
解题思路: 这种做法是基于hdu2037的做法上考虑的,找出所有可以同时搬运的桌子,然后就很方便求出最短总时间. 还有一种更简单的做法是直接遍历一遍找出与别的重复次数最多的那片区域,重复次数*10就可以得到结果. Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 28033    Accepted Submis…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1050 题目大意:就说有一些桌子需要从某些房间搬到另一些房间,但中间只有一条走廊,且走廊中任何一段只能同时进行一次搬运. 思路: 由于有走廊有两边,可以尝试转换成同一边,比如我要从房间6搬到房间10,等价于我从房间5搬到房间9,这样转化之后问题变成了求多个区间的最大重叠次数,直接暴力就可以了,不过有一个坑点,题意只是说从房间x搬到房间y,没说x<y,所以x,y的大小不确定,暴力时需要进行判断. #i…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1050 思路:由图可知,1对应2,3对应4,以此类推,如果x,y是偶数则变为奇数: 每次输入两个区间,找区间重合几次,重合的部分最多的就是最终移动几次. #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> using namespace std; ]; int main…
Moving Tables Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the north side and south side along the corridor. Recently the…
#include <cstdio> #include <algorithm> using namespace std; #define SIZE 205 struct Data_Type { int from, to; bool flag; }moving[SIZE]; bool Cmp(const Data_Type a, const Data_Type b) { return a.from < b.from; } int main(void) { int i, testN…
pid=1050">Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19156    Accepted Submission(s): 6532 Problem Description The famous ACM (Advanced Computer Maker) Company has rented…
题目描述 在一个狭窄的走廊里将桌子从一个房间移动到另一个房间,走廊的宽度只能允许一个桌子通过.给出 t,表示有 t 组测试数据,再给出 n,表示要移动 n 个桌子.n 下面有 n 行,每行两个数字,表示将桌子从 a 房间移动到 b 房间.走廊的分布图如图所示,每移动一个桌子到达目的地需要 10 分钟,问移动 n 个桌子需要的时间 图 输入 3 4 10 20 30 40 50 60 70 80 2 1 3 2 200 3 10 100 20 80 30 50 输出 10 20 30 问题分析 两…