hdu 4884 TIANKENG’s rice shop(模拟)】的更多相关文章

# include <cstdio> # include <algorithm> # include <cstring> # include <cstdlib> using namespace std; int max(int a,int b) { return a>b?a:b; } int main() { int T,n,t,k,m,i,hh,min,id,num,x; int last[1010];//最后一次開始炒饭的时间 int cot[10…
TIANKENG's rice shop 题目链接: http://acm.hust.edu.cn/vjudge/contest/123316#problem/J Description TIANKENG managers a pan fried rice shop. There are n kinds of fried rice numbered 1-n. TIANKENG will spend t time for once frying. Because the pan is so sma…
HDU 4884 TIANKENG's rice shop 题目链接 题意:模拟题.转一篇题意 思路:就模拟就可以.注意每次炒完之后就能够接单 代码: #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int N = 1005; int T, n, t, k, m; struct Person { int t, p, num, ans; } p[N];…
简单模拟,注意并不是完全按照FIFO的顺序.比如第i个人的id为k,那么就算第i+1人的id不为k,也会检查他后续的排队人是否有id为k的. #include <cstdio> #include <cstring> #include <cstdlib> #define MAXN 1005 typedef struct { int tt; int id; int num; int ans; } need_st; need_st needs[MAXN]; int main(…
Problem Description TIANKENG managers a pan fried rice shop. There are n kinds of fried rice numbered 1-n. TIANKENG will spend t time for once frying. Because the pan is so small, TIANKENG can fry k bowls of fried rice with same kind at most. Assumin…
题目链接:hdu 4885 TIANKENG's travel 题目大意:给定N,L,表示有N个加油站,每次加满油能够移动距离L,必须走直线,可是能够为斜线.然后给出sx,sy,ex,ey,以及N个加油站的位置,问说最少经过几个加油站,路过不加油也算. 解题思路:一開始以为经过能够不算,所以o(n2)的复杂度建图,然后用bfs求最短距离,结果被FST了. 将点依照x坐标排序,这样在建图是保证当前点为最左点,每次建立一条边的时候,将该边的斜率记录,下次有同样的斜率则不加边,斜率能够用两个整数表示,…
题目链接:hdu 4122 Alice's mooncake shop 题意: 有n个订单和可以在m小时内制作月饼 接下来是n个订单的信息:需要在mon月,d日,year年,h小时交付订单r个月饼 接下来一行t,s表示制作的月饼可以保质t天,每保质一天需要花费s的价值 接下来m行表示从第0小时开始在该时间制作月饼的花费的价值 求完成所有订单消耗的最小价值. 题解: 这题我还是看了很久才看懂题意,我们将读入的订单处理后,实质就是在一个时间轴上求每个订单时间点i的t区间,也就是i-t<j<=i这个…
TIANKENG's restaurant Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 0    Accepted Submission(s): 0 Problem Description TIANKENG manages a restaurant after graduating from ZCMU, and tens of t…
题意:输入一棵树,输出前k小的点对最短距离dis(i,j)的和. 模拟,官方题解说得很清楚了.不重复了. http://bestcoder.hdu.edu.cn/ 需要注意的是,复杂度要O(n+k),不能用set,map之类的标记是否访问. 一开始TLE了,去掉标记后wa了.最后发现对队列的元素加个前缀,就可以了,即标记该条边是从哪个点延伸的. #include <cstdio> #include <cstring> #include <iostream> #inclu…
NanoApe Loves Sequence 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5805 Description NanoApe, the Retired Dog, has returned back to prepare for the National Higher Education Entrance Examination! In math class, NanoApe picked up sequences once aga…