fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main(){
  6. int T, N, lowerX, higherX, lowerY, higherY, test;
  7. cin >> T;
  8.  
  9. for (int i = 1; i <= T; ++i)
  10. {
  11. cin >> N >> lowerX >> lowerY >> higherX >> higherY;
  12.  
  13. for (int j = 2; j <= N; ++j)
  14. {
  15. cin >> test;
  16. if (test>lowerX)
  17. {
  18. lowerX = test;
  19. }
  20. cin >> test;
  21. if (test>lowerY)
  22. {
  23. lowerY = test;
  24. }
  25. cin >> test;
  26. if (test<higherX)
  27. {
  28. higherX = test;
  29. }
  30. cin >> test;
  31. if (test<higherY)
  32. {
  33. higherY = test;
  34. }
  35. }
  36.  
  37.  
  38.  
  39. if (((higherX-lowerX)==0)&&((higherY-lowerY)==0))
  40. {
  41. cout << "Case #" << i << ": " << 1 << "\n";
  42. } else if ((higherX-lowerX)==0)
  43. {
  44. cout << "Case #" << i << ": " << abs(higherY-lowerY) << "\n";
  45. }else if ((higherY-lowerY)==0)
  46. {
  47. cout << "Case #" << i << ": " << abs(higherX-lowerX) << "\n";
  48. } else {
  49. cout << "Case #" << i << ": " << abs(higherX-lowerX)*abs(higherY-lowerY) << "\n";
  50. }
  51. }
  52.  
  53.  
  54. return 0;
  55. }
Success #stdin #stdout 0.01s 5288KB
stdin
1
4
0 0 10 10
-1 -1 2 2
-10 0 2 100
-10 -10 10 10
stdout
Case #1: 4