POJ 3264 RMQ水题】的更多相关文章

题意:找到一段数字里最大值和最小值的差 水题 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> using namespace std; ; const int INF=0x3f3f3f3f; int n,m,t; ; ],dpMIN[MAXN][]; int mm[MAXN…
题目大意就是有很多牛.告诉你每只牛的高度.然后有很多个询问.输出该区间内的最大身高差.也就是用RMQ求最大值最小值.貌似还可以用线段树.然而,我还不会线段树.....T_T 可能是太多组数据了.cin和cout会TLE.换成scanf和printf就顺当的AC了....啦啦啦. RMQ还是只会用模板..T_T 附代码:#include<stdio.h>#include<string.h>#include<iostream>#include<math.h>#d…
POJ 3264 题意:n个数,问a[i]与a[j]间最大值与最小值之差. 总结:看了博客,记下了模板,但有些地方还是不太理解. #include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<cstring> #include<string> #include<cmath> #include<queue> #…
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight Moves1101 Gamblers1204 Additive equations 1221 Risk1230 Legendary Pokemon1249 Pushing Boxes 1364 Machine Schedule1368 BOAT1406 Jungle Roads1411 Annive…
一.Description As part of an arithmetic competency program, your students will be given randomly generated lists of from 2 to 15 unique positive integers and asked to determine how many items in each list are twice some other item in the same list. Yo…
直接写个RMQ就能过. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #define Max(a,b) ((a)>(b)?(a):(b)) #define Min(a,b) ((a)<(b)?(a):(b)) #define Maxn 60010 using namespace std; ],minnu…
Going Home Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 15944   Accepted: 8167 Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertical…
题目 http://poj.org/problem?id=1837 题意 单组数据,有一根杠杆,有R个钩子,其位置hi为整数且属于[-15,15],有C个重物,其质量wi为整数且属于[1,25],重物与重物之间,钩子与钩子之间彼此不同.忽略杠杆及重心的影响,有多少种方式使得全部重物都挂上钩子(某些钩子可能挂若干个重物)后杠杆平衡? 思路 由于状态比较小,即使n的五次方也足以承受,而且任意时刻杠杆的状态在[-15 * 25 * 20, 15 * 25 * 20]之间,所以可以直接穷举状态. 感想…
Balanced Lineup Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 42929   Accepted: 20184 Case Time Limit: 2000MS Description For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer Joh…
大概题意就是求\(1 \le i,j \le n\)的\(gcd(i,j) = 1\)的个数+2(对于0的特判) 正解应该是欧拉函数或者高逼格的莫比乌斯反演 但数据实在太水直接打表算了 /*H E A D*/ bool GCD[1002][1002]; inline int gcd(int a,int b){return b?gcd(b,a%b):a;} int main(){ rep(i,1,1000) rep(j,1,1000) GCD[i][j]=bool(gcd(i,j)==1); in…