Pages

Thursday 13 September 2012

UVA - 11764 - Jumping Mario

#include <stdio.h>

int main()
{   int t=0,high,low,walls,i,j,x,xlast;
    scanf("%d",&t);
    for(i=1;i<t+1;i++){
        scanf("%d",&walls);
        high=0;
        low=0;
        scanf("%d",&xlast);
        for(j=1;j<walls;j++){
            scanf("%d",&x);
            if(x>xlast)
                high++;
            else if(x<xlast)
                low++;
            xlast=x;
            }
        printf("Case %d: %d %d\n",i,high,low);
        }
    return 0;
}

No comments:

Post a Comment