Files
ARPZ_s1_pr6/task3.h

37 lines
630 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include <iostream>
using namespace std;
#pragma once
namespace task3 {
int init()
{
cout << "TASK #3" << endl;
setlocale(LC_ALL, "Russian");
int n; cout << "Введите длину: "; cin >> n;
int amt = 0;
int* m = new int[n];
cout << "Введите числа: " << endl;
for (int i = 0; i < n; i++)
{
cin>>m[i];
}
int max = 0, cur = 0;
for (int i = 0; i < n; i++)
{
cur = (cur + 1) * (m[i] == 0);
max = cur > max ? cur : max;
}
cout << "а) " << (max >= 2) << endl;
cout << "б) " << (max >= 3) << endl;
delete[] m;
return 0;
}
}