#include <iostream>
#include <windows.h>
#include <vector>
std::vector<int> DoTheJob(std::vector<int> v)
{
int tmp;
std::vector<int> result;
bool flagfound = false;
//sorting
for(int i=0;i<v.size()-1;i++)
{
for (int j=i+1;j<v.size();j++)
{
if(v[j]>v[i])
{
tmp=v[i];
v[i]=v[j];
v[j]=tmp;
};
};
};
//sorting_end
result.push_back(v[0]);
for(int i=1; i<v.size()-2;i++)
{
if (flagfound)
{
break;
}
for(int j=i+1;j<v.size()-1;j++)
{
if (flagfound)
{
break;
};
for(int k=j+1;k<v.size();k++)
{
if (flagfound)
{
break;
};
if(v[0]==v[i]*v[j]*v[k])
{
result.push_back(v[i]);
result.push_back(v[j]);
result.push_back(v[k]);
flagfound = true;
}
};
};
}
return result;
};
int main()
{ int q = 10;
std::vector<int> v;
for (int i=0;i<q;i++)
{
v.push_back((GetTickCount()+rand())%10);
std::cout<< v[i]<<" ";
};
std::cout<<std::endl;
std::vector<int> solution = DoTheJob(v);
std::cout << "Max element: "<<solution[0];
if (solution.size()==4)
{
std::cout<<", multipliers: "<<solution[1]<<", "<< solution[2]<<", "<<solution[3];
}
else
std::cout<< ", no multipliers.";
return 0;
}