#include<iostream>
using namespace std;
int main()
{
int a;
while(cin>>a)
{
for(int i=1;i<=a;i++)
{
int hj=0,lj=0;
int b;
cin>>b;
for(int j=1;j<=b;j++)
{
unsigned short int x[j];
cin>>x[j];
if(j>1)
{
if(x[j]>x[j-1])
{
hj=hj+1;
}
else if(x[j]<x[j-1])
{
lj=lj+1;
}
}
}
cout<<"Case "<<i<<": "<<hj<<" "<<lj<<endl;
}
}
return 0;
}
相信我,我寫起來也差不多,我完全不知道發
了什麼事
相信我,我寫起來也差不多,我完全不知道發
了什麼事
#include <iostream>
using namespace std;
int main ()
{
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int n;
while(cin >> n)
{
for (int k=1;k<=n;k++)
{
int a;
cin >> a;
int q,now,l=0,h=0;
cin >> q;
for (int i=1;i<a;i++)
{
cin >> now;
if (now<q)
{
l++;
q=now;
}
else if (now>q)
{
h++;
q=now;
}
else
{
q=now;
}
}
cout << "Case " << k << ": " << h << " " << l << endl;
}
}
}