题目链接:http://poj.org/problem?id=2823题目大意:给出一组数,一个固定大小的窗体在这个数组上滑动,要求出每次滑动该窗体内的最大值和最小值。这就是典型的单调队列,单调队列的作用就在此。单调队列的队首为区间内的最值,可是整个队列不用保持单调。用两个队列分别处理最大值和最小值...
题意:求最长递增子序列
AC代码:#include
#include
#include
using namespace std;
int dp[1010],a[1010];
int main()
{
int i,j,n;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;...
分类:
其他好文 时间:
2014-07-20 10:28:31
阅读次数:
235
题意:废话了一大堆就是要你去求一个序列冒泡排序所需的交换的次数。
思路:实际上是要你去求一个序列的逆序队数
看案例:
9 1 0 5 4
9后面比它小的的数有4个
1后面有1个
0后面没有
5后面1个
4后面没有
所以结果为4+1+0+1+0=6
所以逆序对的定义如果不清楚可以自己总结了
这道题说白了就是要你用归并排序求逆序对数。
下面是搜到某牛给的逆序对数的方法:...
分类:
其他好文 时间:
2014-07-20 09:38:35
阅读次数:
234
Power of Cryptography
Time Limit: 1000MS
Memory Limit: 30000K
Total Submissions: 18408
Accepted: 9292
题目大意 给出两个数n,k
要你求个数ans ans^n=k
关于题目中的数据范围完全可以用double完爆 没必要用到二分...
分类:
其他好文 时间:
2014-07-20 00:15:46
阅读次数:
196
迷宫问题
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 7560
Accepted: 4426
Description
定义一个二维数组:
int maze[5][5] = {
0, 1, 0, 0, 0,
0, 1, 0, 1,...
分类:
其他好文 时间:
2014-07-19 23:48:39
阅读次数:
365
Hardwood Species
Time Limit: 10000MS
Memory Limit: 65536K
Total Submissions: 17986
Accepted: 7138
Description
Hardwoods are the botanical group of trees that have b...
分类:
其他好文 时间:
2014-07-19 23:48:19
阅读次数:
472
Description
Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponentiat...
分类:
其他好文 时间:
2014-07-19 23:47:19
阅读次数:
418
最短路变形。
题意是说不同的点之间有不同的公司建立了不同连接。
询问 A,B之间如果存在通路,有那些公司。
我用bool g[][][26] 来表示26个字母。然后Floyd, G++就超时。C++ 就AC了。
然后看别人代码才知道还有位运算……ORZ。。。
自己的代码:C++ AC。813ms
#include
#include
#inclu...
分类:
Web程序 时间:
2014-07-19 23:47:19
阅读次数:
353
Antenna Placement
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 6445
Accepted: 3182
Description
The Global Aerial Research Centre has been allotted the t...
分类:
其他好文 时间:
2014-07-19 23:36:19
阅读次数:
377
Ubiquitous Religions
Time Limit: 5000MS
Memory Limit: 65536K
Total Submissions: 23262
Accepted: 11464
Description
There are so many different religions in the world t...
分类:
其他好文 时间:
2014-07-19 23:35:28
阅读次数:
321