// ConsoleApplication2.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <string>
#include<sstream>
#include <deque>
using namespace std;
class Solution {
public:
vector<int> maxInWindows(const vector<int>& num, unsigned int size)
{
vector<int> vec;
if (size <= 0) return vec;
if (size == 1) return num;
if (num.size() < size) return vec;
int count = size;
for (int i = 0; i <= num.size()- count; ++i)
{
int max = num[i];
size = count;
for (int j = i + 1; size != 1; --size, ++j)
{
if (num[j] > max) max=num[j];
}
cout << "max:" << max<<endl;
vec.push_back(max);
}
return vec;
}
};
int main()
{
Solution so;
vector<int> num = { 2,3,4,2,6,2,5,1 };
vector<int> vec = so.maxInWindows(num,3);
for (int i = 0; i < vec.size(); ++i)
{
cout << vec[i] << " ";
}
cout << "程序执行完成!" << endl;
cout << endl;
return 0;
}