Tuesday, February 16, 2016

UVA 11764 - Jumping Mario

/// jumping mario
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h[100], t,cse=0,high=0,low=0 , n;
    memset(h,0,100);
    cin>>t;
    while(t--){
        cin>>n;
        for(int i=0; i<n; i++){
            cin>>h[i];
        }
        for(int i=0; i<n-1; i++){
            if(h[i+1]>h[i])
                high++;
            else if(h[i+1]<h[i])
                low++;
        }
        cout<<"Case "<<++cse<<": "<<high<<" "<<low<<endl;
        high=0,low=0;
    }

   return 0;
}

No comments:

Post a Comment