摘要: http://poj.org/problem?id=3250单调队列,栈模拟有 n 头牛头朝东站成一列。每头牛有一定的高度,并且能看到其前面高度比它低的牛的头顶,直到被某头高度大于等于它的高度的牛所挡住。计算每头牛能看到的牛头顶的数量之和。 1 #include <stdio.h> 2 #include <stack> 3 4 using namespace std; 5 6 stack<pair<int, int> > s; 7 long long sum = 0; 8 9 void push(int a, int i)10 {11 while 阅读全文
posted @ 2013-01-19 15:12 Yuan1991 阅读(149) 评论(0) 推荐(0)