시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 1374 758 648 57.600%

문제

상근이는 기숙사 생활을 한다. 상근이의 방의 크기는 L*W 이다.

수업시간에 타일 채우기 경우의 수를 계산하던 상근이는 자신의 방도 1*1크기 타일로 채우려고 한다. 이때, 가장자리는 빨간색으로, 나머지는 갈색으로 채우려고 한다.

아래 그림은 상근이의 방의 크기가 4*3일 때 이다.

어느날 상근이네 방에 하근이가 놀러왔다. 하근이는 아름다운 타일 배치에 감동받았다. 다시 방으로 돌아온 하근이는 빨간색과 갈색 타일의 개수는 기억했지만, 방의 크기는 기억해내지 못했다.

빨간색과 갈색 타일의 개수가 주어졌을 때, 상근이 방의 크기를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 빨간색 타일의 수 R과 갈색 타일의 수 B가 주어진다. (8 ≤ R ≤ 5000, 1 ≤ B ≤ 2,000,000)

출력

첫째 줄에 상근이네 방의 크기 L과 W을 공백으로 구분하여 출력한다. 만약, 두 수가 다르다면, 큰 수가 L이 되고 작은 수가 W이 된다. 항상 정답이 유일한 경우만 입력으로 주어진다.

예제 입력 1

10 2

예제 출력 1

4 3
W3sicHJvYmxlbV9pZCI6IjI4NTgiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFlMzBcdWMyMTlcdWMwYWMgXHViYzE0XHViMmU1IiwiZGVzY3JpcHRpb24iOiI8cD5cdWMwYzFcdWFkZmNcdWM3NzRcdWIyOTQgXHVhZTMwXHVjMjE5XHVjMGFjIFx1YzBkZFx1ZDY1Y1x1Yzc0NCBcdWQ1NWNcdWIyZTQuIFx1YzBjMVx1YWRmY1x1Yzc3NFx1Yzc1OCBcdWJjMjlcdWM3NTggXHVkMDZjXHVhZTMwXHViMjk0IEwqVyBcdWM3NzRcdWIyZTQuPFwvcD5cclxuXHJcbjxwPlx1YzIxOFx1YzVjNVx1YzJkY1x1YWMwNFx1YzVkMCBcdWQwYzBcdWM3N2MgXHVjYzQ0XHVjNmI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hlIGZpcnN0IGFuZCBvbmx5IGxpbmUgb2YgaW5wdXQgY29udGFpbnMgdHdvIGludGVnZXJzIHNlcGFyYXRlZCBieSBhIHNwYWNlLCBSICh0aGUgbnVtYmVyIG9mIHJlZCBibG9ja3MpIGFuZCBCICh0aGUgbnVtYmVyIG9mIGJyb3duIGJsb2NrcykuIFRoZSBmb2xsb3dpbmcgY29uc3RyYWludHMgd2lsbCBhcHBseTogOCAmbGU7IFIgJmxlOyA1MDAwLCAxICZsZTsgQiAmbGU7IDIgMDAwIDAwMC4mbmJzcDs8XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5UaGUgZmlyc3QgYW5kIG9ubHkgbGluZSBvZiBvdXRwdXQgbXVzdCBjb250YWluIHRoZSBkaW1lbnNpb25zIG9mIHRoZSByb29tLCBMIGFuZCBXLCByZXNwZWN0aXZlbHkuIElmIHRoZSBudW1iZXJzIGRpZmZlciwgb3V0cHV0IHRoZSBncmVhdGVyIG9uZSBmaXJzdC4gVGhlIHRlc3QgZGF0YSB3aWxsIGVuc3VyZSB0aGF0IGEgdW5pcXVlIHNvbHV0aW9uIGFsd2F5cyBleGlzdHMuJm5ic3A7PFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

Contest > Croatian Open Competition in Informatics > COCI 2010/2011 > Contest #4 2번