hdu5032 Always Cook Mushroom】的更多相关文章

题意是这样,给定一个1000x1000的点阵.m组询问.每次询问一个由(0,0).(x,0)点一以及从原点出发的方向向量(a,b)构成的直角三角形包围的点的权值和. 点的权值是(x+A)(y+B),当中A,B是给定的常数 做法也非常显然,将查询离线下来依照方向向量排序,之后的操作就相当于用一根端点在原点的线从x轴開始往y轴扫,不断地把扫到的点的权值增加到树状数组中. 每次扫到某个查询的方向向量时,用这个三角形的底边求前缀和,记录下来就好了. 权值会爆int,注意下就好了 #include<map…
题意:1000*1000的格子, 坐标为(1, 1) ~ (1000, 1000), 常数 A, B, 点(x,  y)权值为 (x + A) * (y + B), q次询问, 每次询问(0, 0) (p,  0), (p, q)的直角三角形内的权值和. 作法: 离线处理, 把所有点和询问放到一起, 按斜率从小到大排序, 考虑每个询问, 那么对当前询问有贡献的点的斜率肯定小于等于该直角三角形斜边的斜率, 所有遇到一个点加入到树状数组, 然后每次询问就是取 区间和了.…
树状数组+询问离线.一个优化是需要的,就是先对1000*1000个点先排序,而不是每次都生成这1000*1000个点然后和询问一起排序,那样会tle. #include <iostream> #include <cstring> #include <string> #include <vector> #include <cstdio> #include <algorithm> #include <cmath> using…
Problem Description Matt has a company, Always Cook Mushroom (ACM), which produces high-quality mushrooms.  ACM has a large field to grow their mushrooms. The field can be considered as a 1000 * 1000 grid where mushrooms are grown in grid points numb…
[A]极角排序+树状数组 [B]计算几何,凸包(队友已出) [C]-_-///不懂 [D]数论,概率密度 [E]图的连通性+Floyed传递闭包+bitset [F]贪心 [G]签到题 [H]区间维护+线段树+DFS序(可以看看) [I]BFS地图题(当时好多人坑在摄像头上面了,现在有一点点思路,分层图,一会看看) [J]-_-///// 貌似除了这两题巨坑的,剩下的都有能出的可能性 [A] Always Cook Mushroom Time Limit: 10000/5000 MS (Java…
Description 题目描述 Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of mushrooms and ask him to grade each mushroom according to its weight. Suppose the weight of a mushroom is w, then it’s grade s is s = 10000 - (100 - w…
Grade Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 109    Accepted Submission(s): 63 Problem Description Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of m…
G - Grade Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of mushrooms and ask him to grade each mushroom according to its weight. Suppose the weight of a mushroom is w, then it’s grade s is s = 10000 - (100 - w)^2What…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4946 Area of Mushroom Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1896    Accepted Submission(s): 452 Problem Description Teacher Mai has a kingd…
0111:Mushroom写情书 查看 提交 统计 提问 总时间限制:  10000ms 内存限制:  256000kB 描述 有一天,Mushroom准备向他的GF表白,为了增加表白成功率,Mushroom写了封情书寄给他的GF(记为S1),而他的GF也回寄了一封(记为S2).现在,Mushroom想知道,这两封信的最长公共子串是多少. 输入 两行仅包含小写字母的字符串(S1,S2). 输出 当不存在公共字符串时,输出一行0,.否则先输出一行表示最长公共子串,再输出最长公共子串的长度,如果有多…