[ create a new paste ] login | about

Link: http://codepad.org/yKsBT8Gs    [ raw code | output | fork ]

iamyeasin - C++, pasted on Jan 18:
#include<iostream>
#include<stdio.h>

using namespace std;

int main()
{
    int kase,T=0;
    int arr[50];
    scanf("%d",&kase);

    while(kase--)
    {
        int n,lo=0,hi=0;
        scanf("%d",&n);

        for(int i=0; i<n; i++)
        {
            scanf("%d",&arr[i]);
        }

        for(int i=1; i<n; i++)
        {
            if(arr[i] > arr[i-1])
            {
                hi++;
            }
            else if(arr[i] < arr[i-1])
            {
                lo++;
            }
        }

        printf("Case %d: %d %d\n",++T,hi,lo);

    }

    return 0;
}


Output:
1
Timeout


Create a new paste based on this one


Comments: