Pages

Tuesday, November 30, 2010

UVA Problem#11764

Question:

Solution:
1. Take an integer input indating the test cases (say t). For each case take another integer input indicating the number of pillars (say n). Then take input of those pillars in an array (say a[ ] )
2. Just check for two conditions, whether a[j+1] > a[ j] or a[ j+1] < a [ j]

int main(){
....
....
...
       for(j=0; j<n-1; j++){
            if(a[j+1] > a[j])
                hj++;
            else if(a[j+1]< a[j])
                lj++;
        }
....
.....
}

No comments:

Post a Comment