Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int n,l,h,xg,yg,lg,hg;
- int ox[20],oy[20];
- void smax(int x,int y,int lung,int inalt)
- { bool egaura=false;
- int i=1;
- while(i<=n&&!egaura)
- if((ox[i]>x)&&(ox[i]<(x+lung))&&(oy[i]>y)&&(oy[i]<(y+inalt)))
- egaura=true;
- else
- i++;
- if(egaura)
- {
- smax(x,y,ox[i]-x,inalt);
- smax(ox[i],y,x+lung-ox[i],inalt);
- smax(x,y,lung,oy[i]-y);
- smax(x,oy[i],l,y+inalt-oy[i]);
- }
- else
- if(lung*inalt>lg*hg)
- {
- xg=x;
- yg=y;
- lg=lung;
- hg=inalt;
- }
- }
- int main()
- {
- cin>>l>>h>>n;
- for(int i=1;i<=n;i++)
- cin>>ox[i]>>oy[i];
- xg=0;
- yg=0;
- lg=0;
- hg=0;
- smax(0,0,l,h);
- cout<<endl<<"coordonate x="<<xg<<" y="<<yg<<" L="<<lg<<" H="<<hg;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement