Advertisement
Guest User

Untitled

a guest
Apr 10th, 2019
1,719
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int ar[200000];
  5.  
  6. int main() {
  7.  
  8. int n;
  9.  
  10. while(cin>>n) {
  11.  
  12.  
  13. multiset<int> mt;
  14.  
  15. for(int i=1; i<=n; i++)
  16. scanf("%d",ar+i);
  17.  
  18. int k=12,cnt=0;
  19.  
  20. for(int i=1; i<=n; i++) {
  21.  
  22. int sum=0;
  23.  
  24. mt.insert(ar[i]);
  25.  
  26. for(int j=1; j<=i; j++)
  27. sum+=ar[j];
  28.  
  29. if(sum>k)
  30. cnt++;
  31.  
  32. }
  33.  
  34. cout<<cnt<<endl;
  35.  
  36.  
  37. }
  38.  
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement