Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- http://bacinfo.cnlr.ro/subiecte-bac/2009/e_info_intensiv_c_siii_023.pdf
- Var 23 SIII Ex 4
- */
- #include <iostream>
- #include <fstream>
- using namespace std;
- struct interval
- {
- int a,b;
- }s[1001] ;
- ifstream f("BAC.TXT");
- int main()
- {
- int n;
- f>>n;
- for(int i=1;i<=n;i++)
- {
- f>>s[i].a>>s[i].b;
- }
- int ok=1;
- for(int i=1;i<=n;i++)
- {
- ok=1;
- for(int j=1;j<=n;j++)
- {
- if(i!=j)
- {
- if(s[i].a<=s[j].a && s[i].b>=s[j].a ||
- s[i].a<=s[j].b && s[i].b>=s[j].b ||
- s[i].a>=s[j].a && s[i].b<=s[j].b)
- ok=0;
- }
- }
- if(ok==1)
- cout<<s[i].a<<" "<<s[i].b<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement