Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ofstream fout("fisier.out");
  7.  
  8. int ariemax, n;
  9.  
  10. struct{
  11. int x, y;
  12. }g[102];
  13.  
  14. void taietura(int x, int y, int l, int h)
  15. {
  16. bool p=0, i;
  17.  
  18. while (i<=n && !p)
  19. {
  20. if ((g[i].x > x && g[i].x < x+l) && (g[i].y > y && g[i].y < y+h))
  21. p=1;
  22. else ++i;
  23. }
  24.  
  25. if (p)
  26. {
  27. taietura(x, y, g[i].x-x, h);
  28. taietura(g[i].x, y, x+l-g[i].x, h);
  29. taietura(x, y, l, h-g[i].y);
  30. taietura(x, g[i].y, l, h+y-g[i].y);
  31. }
  32. else
  33. if (l*h > ariemax)
  34. ariemax=l*h;
  35. }
  36.  
  37. int main()
  38. {
  39. cin >> n;
  40.  
  41. for (int i=1; i<=n; ++i)
  42. cin >> g[i].x >> g[i].y;
  43.  
  44. fout << g[1].x << " " << g[1].y;
  45.  
  46. int x, y, l, h;
  47. cin >> x >> y >> l >> h;
  48.  
  49. taietura(x, y, l, h);
  50.  
  51. cout << ariemax;
  52.  
  53. return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement