시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 961 545 462 59.536%

문제

상근이는 기숙사 생활을 한다. 상근이의 방의 크기는 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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29udGFpbnMgdHdvIGludGVnZXJzIHNlcGFyYXRlZCBieSBhIHNwYWNlLCBSICh0aGUgbnVtYmVyIG9mIHJlZCBibG9ja3MpIGFuZCBCICh0aGUgbnVtYmVyIG9mIGJyb3duIGJsb2NrcykuIFRoZSBmb2xsb3dpbmcgY29uc3RyYWludHMgd2lsbCBhcHBseTogOCAmbGU7IFIgJmxlOyA1MDAwLCAxICZsZTsgQiAmbGU7IDIgMDAwIDAwMC4mbmJzcDs8XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5UaGUgZmlyc3QgYW5kIG9ubHkgbGluZSBvZiBvdXRwdXQgbXVzdCBjb250YWluIHRoZSBkaW1lbnNpb25zIG9mIHRoZSByb29tLCBMIGFuZCBXLCByZXNwZWN0aXZlbHkuIElmIHRoZSBudW1iZXJzIGRpZmZlciwgb3V0cHV0IHRoZSBncmVhdGVyIG9uZSBmaXJzdC4gVGhlIHRlc3QgZGF0YSB3aWxsIGVuc3VyZSB0aGF0IGEgdW5pcXVlIHNvbHV0aW9uIGFsd2F5cyBleGlzdHMuJm5ic3A7PFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

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

  • 문제를 번역한 사람: baekjoon
  • 문제의 오타를 찾은 사람: luke0201