Advertisement
2000fer

Untitled

Apr 26th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7.  
  8. vector <int> extremosNS;
  9. vector <int> extremosOE;
  10. int a,b,menorN,mayorN,menorO,mayorO,n=0;
  11.  
  12. for(int i=0;i<4;i++){ //Cargo las coordenadas de los extremos
  13. cin >> a >> b;
  14. extremosNS.push_back(a);
  15. extremosOE.push_back(b);}
  16.  
  17. menorN=extremosNS[0]; //Carga los menores y mayores
  18. mayorN=extremosNS[0];
  19. for(int i=0;i<4;i++){
  20. if(extremosNS[i]<menorN){
  21. menorN= extremosNS[i];}
  22. if(extremosNS[i]>mayorN){
  23. mayorN= extremosNS[i];}}
  24. menorO=extremosOE[0];
  25. mayorO=extremosOE[0];
  26. for(int i=0;i<4;i++){
  27. if(extremosOE[i]<menorO){
  28. menorO= extremosOE[i];}
  29. if(extremosOE[i]>mayorO){
  30. mayorO= extremosOE[i];}}
  31.  
  32. int numeroBebidas;
  33. cin >> numeroBebidas;
  34.  
  35.  
  36. for(int i=0;i<numeroBebidas;i++){
  37. cin >> a >> b;
  38. if (a>= menorN && a<=mayorN && b <= mayorO && b>=menorO){
  39. n++;}}
  40.  
  41. cout <<endl << n;
  42.  
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement