Programul afiseaza toate secventele posibile in outputul ferestrei
#include <iostream>
#include <fstream>
using namespace std;
int divizori[300];
int main(){
int n,i,k=0,j,temp,v[100],nr=0,div2,div3,div5;
ifstream fin("produs3.in");
ofstream fou("produs3.out");
fin>>n;
for(i=0;i<n;i++){
fin>>v[i];
temp=v[i];
while(temp%2==0){
divizori[3*i]++;
temp=temp/2;
}
temp=v[i];
while(temp%3==0){
divizori[3*i+1]++;
temp=temp/3;
}
temp=v[i];
while(temp%5==0){
divizori[3*i+2]++;
temp=temp/5;
}
}
while(k<n){
div2=0;
div3=0;
div5=0;
for(i=k;i<n;i++){
div2=div2+divizori[3*i];
div3=div3+divizori[3*i+1];
div5=div5+divizori[3*i+2];
if(div2%2==0&&div3%2==0&&div5%2==0){
nr++;
for(j=k;j<=i;j++){
cout<<v[j]<<" ";
}
cout<<endl;
}
}
k++;
}
fou<<nr;
return 0;
}