fork download
  1. #include <iostream>
  2.  
  3. const double max_h = 1000.0;
  4. static double table [] = { 136, 577, 110, 927, 472, 199, 157, 808, 388, 598, 94, 31, 388, 157, 325, 409, 787, 897, 850, 598, 0.0, 0.0 };
  5.  
  6. struct extremum {
  7. public:
  8. double x0, y0, h, c, S2;
  9. int flag;
  10.  
  11. extremum() { x0 = y0 = h = c = 0.0; S2 = 1000.0 * 1000.0 + 0.1; flag = 0; }
  12. void regist(double x0, double y0, double h, double c, double S2, int flag) {
  13. this->x0 = x0; this->y0 = y0; this->h = h; this->c = c; this->S2 = S2; this->flag = flag;
  14. }
  15. double fetch() { return S2; }
  16. void output() {
  17. if (flag == 0) {
  18. std::cout << '(' << x0 << ',' << y0 << "), ";
  19. std::cout << '(' << x0 + h << ',' << y0 << "), ";
  20. std::cout << '(' << x0 + h << ',' << y0 + h << "), ";
  21. std::cout << '(' << x0 << ',' << y0 + h << "), ";
  22. std::cout << "S^2 =" << S2 << std::endl;
  23. } else if (flag > 0) {
  24. } else {
  25. }
  26. }
  27. };
  28.  
  29. extremum extremumS;
  30.  
  31. double ext_x0S = 0.0, ext_y0S = 0.0, ext_hS = 0.0, ext_cS = 0.0, ext_flagS = 0, ext_s2S = 1000.0 * 1000.0 + 0.1;
  32. double delta = 1.0;
  33.  
  34. double f(double delta_x, double delta_y, double x1, double y1, double X, double Y) {
  35. return delta_y * (X - x1) + delta_x * (y1 - Y);
  36. }
  37.  
  38. void check1(double x0, double y0, double h) {
  39. for (int i = 0; !(table[i] == 0.0 && table[i + 1] == 0.0); i += 2) {
  40. double X = table[i], Y = table[i + 1];
  41. if (!(X >= x0 && X <= x0 + h && Y >= y0 && Y <= y0 + h))
  42. return;
  43. }
  44. double S2 = h * h;
  45. if (S2 <= extremumS.fetch()) {
  46. extremumS.regist(x0, y0, h, 0.0, S2, 0);
  47. }
  48. }
  49.  
  50. void check2(double x0, double y0, double h, double c) {
  51. }
  52.  
  53. void check3(double x0, double y0, double h, double c) {
  54. }
  55.  
  56. int main() {
  57. double h;
  58. for (h = max_h; h > 0.0; h = h - delta) {
  59. double x0, y0;
  60. for (x0 = 0; x0 <= max_h - h; x0 = x0 + delta) {
  61. for (y0 = 0; y0 <= max_h - h; y0 = y0 + delta) {
  62. check1(x0, y0, h);
  63. /*
  64.   double c;
  65.   for (c = 0.0 + delta; c <= h / 2.0; c = c + delta)
  66.   check2(x0, y0, h, 0.0);
  67.   for (c = 0.0 + delta; c <= h / 2.0; c = c + delta)
  68.   check3(x0, y0, h, 0.0);
  69. */
  70. }
  71. }
  72. }
  73. extremumS.output();
  74.  
  75. return 0;
  76. }
  77. /* end */
  78.  
Success #stdin #stdout 1.02s 15240KB
stdin
Standard input is empty
stdout
(94,31), (990,31), (990,927), (94,927), S^2 =802816