Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 02. Ranges.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include <iostream>
- #include<string>
- #include <sstream>
- #include <set>
- #include <algorithm>
- #include <queue>
- using namespace std;
- int main()
- {
- pair<int, int>* range = new pair<int, int>[10000];
- string input;
- int currPos = 0;
- while (true)
- {
- getline(cin, input);
- if (input == ".")
- break;
- istringstream istr(input);
- // int num;
- // istr >> num;
- istr >> range[currPos].first;
- istr >> range[currPos].second;
- currPos++;
- }
- int lastRange = currPos;
- while (true)
- {
- currPos = 0;
- getline(cin, input);
- if (input == ".")
- break;
- while (currPos <= lastRange)
- {
- istringstream istr(input);
- int num;
- istr >> num;
- if (range[currPos].first <= num && num <= range[currPos].second)
- break;
- currPos++;
- }
- if(currPos < lastRange)
- cout << "in" << endl;
- else
- cout << "out" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment