Solution of 11764 UVA number !
please do not copy it rather watch it for learning purpose :)
Here is the code :-
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
//mechaboo
int testCases;
cin >> testCases;
for (int i=0;i<testCases;i++)
{
int len,maxx=0,minn=0;
cin >> len;
int arrJumps[len] ;
for(int j=0;j<len;j++)
{
cin >> arrJumps[j];
if(j!=0)
{
if(arrJumps[j]>arrJumps[j-1])maxx++;
if(arrJumps[j]<arrJumps[j-1])minn++;
}
}
cout << "Case "<<i+1<<": "<<maxx<<" "<<minn<<endl;
//mechaboo
}
return 0;
}
If you do not understand please leave a message here.
or mail us mechaboo786@gmail.com
or you can leave a message at fb . Link :- https://www.facebook.com/mechaboo/
please do not copy it rather watch it for learning purpose :)
Here is the code :-
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
//mechaboo
int testCases;
cin >> testCases;
for (int i=0;i<testCases;i++)
{
int len,maxx=0,minn=0;
cin >> len;
int arrJumps[len] ;
for(int j=0;j<len;j++)
{
cin >> arrJumps[j];
if(j!=0)
{
if(arrJumps[j]>arrJumps[j-1])maxx++;
if(arrJumps[j]<arrJumps[j-1])minn++;
}
}
cout << "Case "<<i+1<<": "<<maxx<<" "<<minn<<endl;
//mechaboo
}
return 0;
}
If you do not understand please leave a message here.
or mail us mechaboo786@gmail.com
or you can leave a message at fb . Link :- https://www.facebook.com/mechaboo/
Comments
Post a Comment