#33279: _C++


50915130@gm.nfu.edu.tw (丁丁)


include <iostream>
using namespace std;
int main(){
    int t = 0,ts=1;
    cin >>t;
    while(t--){
        int j=0;
        cin >>j;
        j--;
        int tower=0; //第一個塔的高度
        cin >> tower; 
        int high=0,low=0;
        while(j--){
            int next; //下一個塔的高度
            cin >> next; 
            if(tower<next) //如果比較高 high++
                high++;
            if(tower>next) //如果比較矮 low++
                low++;
            tower=next;    //到下一個塔上,一樣高直接到下一個塔

       }
        cout << "Case " << ts <<": " <<high<<" "<<low<<endl; // 輸出
        ts++; //Case ts: high low\r\n

   }
}

#38475: Re: C++


a0978435327@gmail.com (Zi-ke_Liao)


include
using namespace std;
int main(){
    int t = 0,ts=1;
    cin >>t;
    while(t--){
        int j=0;
        cin >>j;
        j--;
        int tower=0; //第一個塔的高度
        cin >> tower; 
        int high=0,low=0;
        while(j--){
            int next; //下一個塔的高度
            cin >> next; 
            if(tower
                high++;
            if(tower>next) //如果比較矮 low++
                low++;
            tower=next;    //到下一個塔上,一樣高直接到下一個塔

       }
        cout << "Case " << ts <<": " <
        ts++; //Case ts: high low\r\n

   }
}


???