Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- struct tt{
- int l, r;
- };
- int main()
- {
- int n, i, j, z;
- long long sum = 0, ans = 0;
- cin >> n;
- vector <int> a(n);
- for ( i = 0; i < n; i++)
- cin >> a[i];
- for ( i = 0; i < n; i++){
- sum = a[i];
- j = i;
- z = 1;
- while (sum > 0 && z <= n){
- sum += a[j];
- z++;
- j = (j + 1) % n;
- }
- if (!(z == n && sum < 0) && !(z < n))
- ans++;
- }
- cout << ans << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement