UVA 11764 - Jumping Mario





A solution in c++

#include<bits/stdc++.h>
using namespace std;

int arr[1000],brr[1006];
int main()
{
   int T;
    cin >> T;

    for (int t = 1; t <= T; ++t)
    {
        int n;

        cin >> n;

        int increase(0), decrease(0);

        int previous, current;

        cin >> previous;

        for (int i = 1; i < n; ++i)
        {
            cin >> current;

            if (current > previous)
                ++increase;
            else if (current < previous)
                ++decrease;

            previous = current;
        }
        cout << "Case " << t << ": " << increase << " " << decrease <<'\n';
    }
}

Post a Comment

2 Comments

  1. This problem is good. I didn't solved it when I was beginner but It's a good problem for beginners. But I think you should avoid writing all those Header files below . It really looks ugly and it's unnecessary. Because contains all those headers. :)

    ReplyDelete
    Replies
    1. Thanks for comment in my site.
      Next time i try to avoid unnecessary headers. :)

      Delete

If you have any doubts, Please let me know