Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int red, brown,p,q,l,b,red_tiles;
- cin>>red>>brown;
- for (int i=1; i<=sqrt(brown); i++)
- {
- if (brown%i == 0)
- {
- p=i;
- q=(brown/i);
- red_tiles = p*2+q*2+4;
- if (red_tiles == red)
- {
- l = (p>=q)?p:q;
- b = (p<q)?p:q;
- cout << l+2 << " " << b+2 << endl;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement