#K1561. Arrange Photos in a Grid
Arrange Photos in a Grid
Arrange Photos in a Grid
You are given an integer n representing the number of photos you have. Your task is to arrange these photos into a grid with r rows and c columns such that the grid is as "even" as possible. In other words, you want to minimize the absolute difference between the number of rows and columns, i.e. \(|r-c|\). If there are several valid configurations, choose the one with the smallest number of rows. Note that if n equals 0, you should output "0 0".
Constraints: \(0 \le n \le 10^5\) (for instance).
inputFormat
The input consists of a single integer n provided via standard input (stdin), which represents the number of photos.
outputFormat
Output two space-separated integers r and c to standard output (stdout), where r denotes the number of rows and c denotes the number of columns in the grid. For n = 0, output "0 0".
## sample0
0 0