| 记录编号 | 197128 | 评测结果 | AAAAAAAAAA | ||
|---|---|---|---|---|---|
| 题目名称 | 1461.[SPOJ 1739] Pell方程 | 最终得分 | 100 | ||
| 用户昵称 | 是否通过 | 通过 | |||
| 代码语言 | C++ | 运行时间 | 0.003 s | ||
| 提交时间 | 2015-10-23 16:14:52 | 内存使用 | 0.29 MiB | ||
#include<stdio.h>
#include<math.h>
int main()
{
freopen("pell.in","r",stdin);
freopen("pell.out","w",stdout);
int i=1,N,x,y,u=0;
scanf("%d",&N);
while(1)
{for(x=1;x<=i;x++)
if(i*i-N*x*x==1)
{printf("%d %d",i,x);u=1;break;}
if(u==1)break;
i++;
}
return 0;
}