回分類題庫
d160: OOP Lab Exercise: Strictly Increasing Vector
出處:

Difficulity : 1
Accepted : 94 Times | Submit :170 Times | Clicks : 1979
Accepted : 82 Users | Submit : 84 Users | Accepted rate : 98%
Time Limit :10000 ms | Memory Limit : 64000 KBytes
題目加入時間 : 2010-03-09 14:45

Content :

Strictly Increase Sequence V satisfies:

1.  If the sequence’s length is 0 or 1.

2.  Or for each elements in the sequence satisfy: V[0] < V[1] < ... < V[length-1]

3.  Otherwise, we say the sequence is not a strictly increasing sequence.

 

You are asked to write a program to determine a sequence if it is strictly increasing.
You have to use “ #include “std_lib_facilities.h” ” in your code.
Your code must be implemented in recursive function.

Hint:

Header file is here:  http://www.cs.nccu.edu.tw/~g9803/oop/std_lib_facilities.h


#include "std_lib_facilities.h"


bool strictly_increasing(vector<int> v){

}

int main(){
    vector<int> vec;
    int input;

    while(cin >> input){
        if(input <= -999999){
           cout << strictly_increasing(vec) << endl;

           // do something
        }
        else{
           // do something
        }
    }
    return 0;
}

 

Input :

There are sets of sequence. For each set, there are several integers and end with -999999. That is every elements in this sequence are > -999999.

Output :

Each line represent the result of each set.
1 => The sequence is strictly increasing.
0 => The sequence is not strictly increasing.

Sample Input :

1
2
3
-999999
5566
183
7788
-999999

Sample Output :

1
0

Hint :


  

Author :


  Solve it!   Status Forum (0)

C++
C
JAVA
20307. Assassincross (8 ms , 422KB)
33315. oop99703028 (12 ms , 442KB)
33312. hubuki (12 ms , 526KB)
24422. leopan0922 (12 ms , 342KB)
33314. oop98703024 (20 ms , 528KB)
56447. ag100 (4 ms , 196KB)
18692. yuhanlyu (6 ms , 206KB)
56445. ag100 (8 ms , 200KB)
29015. king_of_laba (8 ms , 214KB)
87058. nccucs105703018 (12 ms , 306KB)
56506. nwgs524513cja (190 ms , 2800KB)
50694. nwgs524513cja (190 ms , 3132KB)
50693. nwgs524513cja (212 ms , 3170KB)

執行時間會受很多因素影響因此僅供參考,主機等級請看這裡