Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int *arr = new int[n];
- for (int i = 0; i < n; i++)
- std::cin >> arr[i];
- int count = 0;
- int max_count = 0;
- for (int i = 0, sum = 0; i < n; i++)
- {
- for (int j = i; j < n; j++)
- {
- sum += arr[j];
- if (sum % 19 == 0)
- if (j-i+1 > max_count)
- max_count = j-i+1;
- if (max_count == n)
- break;
- }
- if (max_count == n)
- break;
- sum = 0;
- }
- cout << max_count;
- delete []arr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement