Advertisement
facug91

Untitled

May 23rd, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int dt, a[20], ans;
  6.  
  7. int main () {
  8.     int tc, i, j, k;
  9.    
  10.     cin>>tc;
  11.     while (tc--) {
  12.         cin>>dt;
  13.         for (i=0; i<15; i++) cin>>a[i];
  14.         ans = 0;
  15.         for (i=1; i<14; i++) for (j=i; j<14; j++) {
  16.             bool isl = true;
  17.             for (k=i; k<=j; k++) if (a[k] <= a[i-1] || a[k] <= a[j+1]) isl = false;
  18.             if (isl) ans++;
  19.         }
  20.         cout<<dt<<" "<<ans<<endl;
  21.     }
  22.    
  23.    
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement