Added my works from 2022
This commit is contained in:
38
task3.h
Normal file
38
task3.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace task3 {
|
||||
|
||||
int init()
|
||||
{
|
||||
|
||||
cout << "TASK #3" << endl;
|
||||
|
||||
setlocale(LC_ALL, "Russian");
|
||||
int n; cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: "; cin >> n;
|
||||
int amt = 0;
|
||||
int* m = new int[n];
|
||||
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>: " << 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 << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> " << max * (max!=1) << " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>\n";
|
||||
cout << "<EFBFBD>) " << (max >= 2) << endl;
|
||||
cout << "<EFBFBD>) " << (max >= 3) << endl;
|
||||
|
||||
delete[] m;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user