#K81357. Largest Square Formation

    ID: 35735 Type: Default 1000ms 256MiB

Largest Square Formation

Largest Square Formation

You are given a single integer \(N\) which represents the total number of students. Your task is to arrange as many students as possible into a square formation. Let \(s\) be the largest integer such that \(s^2 \leq N\). The square will have \(s\) students per side, forming \(s^2\) students in total, and the number of leftover students will be \(N - s^2\).

For example, if \(N = 10\), the largest \(s\) is 3 since \(3^2 = 9 \leq 10\) and the leftover students are \(10 - 9 = 1\). Similarly, if \(N = 25\) then \(s = 5\) with \(25 - 25 = 0\) leftover students.

Input: A single integer \(N\).

Output: Two integers separated by a space: the first is \(s\) and the second is the number of leftover students.

inputFormat

The input consists of a single integer N provided via standard input (stdin).

outputFormat

Output two integers separated by a space. The first integer is the side length of the largest square formation (\(s\)) and the second integer is the number of leftover students, i.e., N - s2.

## sample
10
3 1

</p>