Banner Home Page DIY Contests Problems Ranklist Status Statistics
1003数据时完整的数据 暴力好像是过不去的啦~

G.K阶整数对

Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 12   Accepted Submission(s) : 11

Font: Times New Roman | Verdana | Georgia

Font Size:

Problem Description

设一个有序整数对(n,m)满足如下关系:
1) (n2-m*n-m2)2=1
2) n>=m
3) n>=1,m>=1
现将所有满足条件的(n,m)升序排列,问第K个序列是多少?

Input

每个测试用例包含单个整数k(1 < = k < = 109)。输入k = 0时终止。

Output

为每个测试用例,输出一行m和n的值在 mod 2009后。两个整数用空格分隔。

Sample Input

4
20
0

Sample Output

3 5
738 901

Author

syu

Source

Developing School's Contest 6

Statistic | Submit | Back