#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string>
using namespace std;
short arr[1000];
void FillArr(short arr[1000])
{
ifstream file;
file.open("number.txt");
for(int i=0; i<1000; i++)
file >> arr[i];
file.close();
}
void PrintArr(short arr[1000])
{
for(int i=0; i<1000; i++)
cout << arr[i];
}
unsigned long long int Find(short arr[1000])
{
unsigned long long int tmp,maxim = 0;
unsigned long long int tmp1,tmp2 = 0;
for(int i=1; i<988; i++)
{
tmp1=arr[i]*arr[i+1]*arr[i+2]*arr[i+3]*arr[i+4]*arr[i+5]*arr[i+6]*arr[i+7];
tmp2=arr[i+8]*arr[i+9]*arr[i+10]*arr[i+11]*arr[i+12];
tmp=tmp1*tmp2;
if(tmp > maxim)
maxim=tmp;
cout << endl << "Max: " << maxim << " i: " << i << " " << arr[i] << " " << arr[i+1] << " " << arr[i+2] << " " << arr[i+3] << " " << arr[i+4] << " " << arr[i+5] << " " << arr[i+6] << " " << arr[i+7] << " " << arr[i+8] << " " << arr[i+9] << " " << arr[i+10] << " " << arr[i+11] << " " << arr[i+12] << " " << tmp;
}
return maxim;
}
int main()
{
FillArr(arr);
PrintArr(arr);
cout << endl << Find(arr);
return 0;
}
-----------------number.txt--------------------
Darmowy hosting zapewnia PRV.PL