56 lines
877 B
C++
56 lines
877 B
C++
|
#include <iostream>
|
||
|
#include <vector>
|
||
|
using namespace std;
|
||
|
|
||
|
int main() {
|
||
|
|
||
|
/* Type your code here. */
|
||
|
/*
|
||
|
* get list of ints from input
|
||
|
* input begins with number of inputs
|
||
|
* Then the list
|
||
|
* Then two more numbers, upper and lower bounds of a range
|
||
|
* incluseive of bounds
|
||
|
* Output all ints within the range
|
||
|
* follow each output with a comma
|
||
|
* end with newline
|
||
|
* example:
|
||
|
* Input:
|
||
|
* 5 25 51 0 200 33
|
||
|
* 0 50
|
||
|
* Output: 25,0,33,
|
||
|
*/
|
||
|
|
||
|
vector<int> intList;
|
||
|
int vectorSize;
|
||
|
int unsigned i;
|
||
|
int max;
|
||
|
int min;
|
||
|
|
||
|
//get list size
|
||
|
cin >> vectorSize;
|
||
|
|
||
|
intList.resize(vectorSize);
|
||
|
|
||
|
// Get list
|
||
|
for (i=0; i < intList.size(); i++){
|
||
|
cin >> intList.at(i);
|
||
|
}
|
||
|
|
||
|
// get max and min
|
||
|
cin >> min;
|
||
|
cin >> max;
|
||
|
|
||
|
for (i=0; i<intList.size(); i++){
|
||
|
if( intList.at(i) >= min &&
|
||
|
intList.at(i) <= max){
|
||
|
cout << intList.at(i) << ",";
|
||
|
}
|
||
|
}
|
||
|
cout << endl;
|
||
|
|
||
|
|
||
|
|
||
|
return 0;
|
||
|
}
|