Code for USACO practice problems
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#include <algorithm>
|
|
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
int n;
|
|
|
|
int a = 0;
|
|
|
|
cin >> n;
|
|
|
|
int flower_array[n];
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
cin >> flower_array[i];
|
|
|
|
}
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
for (int j = 0; j < n - i; j++) {
|
|
|
|
double average = 0;
|
|
|
|
for (int k = 0; k <= j; k++) {
|
|
|
|
average += flower_array[i+k];
|
|
|
|
}
|
|
|
|
average /= (j+1);
|
|
|
|
for (int k = 0; k <= j; k++) {
|
|
|
|
if (flower_array[i+k] == average) {
|
|
|
|
a++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//a -= n;
|
|
|
|
cout << a;
|
|
|
|
return 0;
|
|
|
|
}
|