onilink_

Untitled

Feb 8th, 2019
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1.     Rect max;
  2.     for(unsigned l1=0; l1<LINES; ++l1) {
  3.         for(unsigned l2=l1; l2<LINES; ++l2) {
  4.             for(unsigned c1=0; c1<COLS; ++c1) {
  5.                 for(unsigned c2=c1; c2<COLS; ++c2) {
  6.                     bool rect_noir = true;
  7.                     for(unsigned l=l1; rect_noir && l<=l2; ++l) {
  8.                         for(unsigned c=c1; rect_noir && c<=c2; ++c) {
  9.                             if(im({c,l}) == od::Color::White) {
  10.                                 rect_noir = false;
  11.                             }
  12.                         }
  13.                     }
  14.                     if(rect_noir) {
  15.                         unsigned hei = l2 - l1 + 1;
  16.                         unsigned wid = c2 - c1 + 1;
  17.                         unsigned area = wid * hei;
  18.                        
  19.                         if(max.area < area) {
  20.                             max.pos.x = c1;
  21.                             max.pos.y = l1;
  22.                             max.size.wid = wid;
  23.                             max.size.hei = hei;
  24.                             max.area = area;
  25.                         }
  26.                     }
  27.                 }
  28.             }
  29.         }
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment