P26339 [AtCoder] Pascal's Triangle
普及
题目描述

Problem Description

Takahashi loves Pascal's Triangle.

Pascal's Triangle is a triangle that can be constructed by writing down numbers obtained by adding the number above to the right and the number above to the left.

The $ y $th row of Pascal's Triangle consists of $ y $ numbers, and if we denote the number in the $ y $th row and $ x $th position as $ f(y,x) $, it is defined as:

  • When $ x = 1 $ or $ x = y $, $ f(y,x) = 1 $
  • Otherwise, $ f(y,x) = f(y-1,x) + f(y-1,x-1) $

Takahashi wants to find out if a certain integer $ A $ is included in Pascal's Triangle.

If $ A $ appears in Pascal's Triangle, output the row number and the position in that row. If it does not appear, output -1 -1.

Input Format

The input is given from the standard input in the following format:

$ A $

  • The first line contains an integer $ A (1 ≦ A ≦ 10^9) $.

Output Format

If $ A $ appears in Pascal's Triangle, output the row number and the position in that row separated by a space. If it does not appear, output -1 -1. The output should end with a newline.

The output numbers must be integers less than or equal to $ 2 × 10^9 $.

Sample Input and Output

Sample Input #1

10

Sample Output #1

6 3

Sample Input #2

3921225

Sample Output #2

101 5

Notes/Hints

Sample Explanation 1

The number in the 6th row and 3rd position is 10. Other positions in the 6th row like the 4th position also satisfy the condition, but any valid output is acceptable.

Sample Explanation 2

A sufficiently large number may be given as input.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
10
样例输出
6 3