[ZJd660][UVA11764] Jumping Mario
題目:
http://zerojudge.tw/ShowProblem?problemid=d660
=========================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
int T,i = 0;
scanf("%d",&T);
while(T--)
{
int n,a, highsum = 0, lowsum = 0, odd = 0;
scanf("%d",&n);
scanf("%d",&a);
odd = a;
while(n-->1)
{
scanf("%d",&a);
if(a > odd)
highsum++;
if(a < odd)
lowsum++;
odd = a;
}
i++;
printf("Case %d: %d %d\n",i,highsum,lowsum);
}
return 0;
}
http://zerojudge.tw/ShowProblem?problemid=d660
=========================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
int T,i = 0;
scanf("%d",&T);
while(T--)
{
int n,a, highsum = 0, lowsum = 0, odd = 0;
scanf("%d",&n);
scanf("%d",&a);
odd = a;
while(n-->1)
{
scanf("%d",&a);
if(a > odd)
highsum++;
if(a < odd)
lowsum++;
odd = a;
}
i++;
printf("Case %d: %d %d\n",i,highsum,lowsum);
}
return 0;
}
留言
張貼留言