Description

求关于x y的二次不定方程的解 x2-ny2=1

Input

多组输入数据,先输入组数T 然后输入正整数n(n<=100)

Output

对于每组数据输出一行,求y<=10000的最小正整数解 ,输出y的值,如果在此范围内没有解则输出No

Sample Input

1
73

Sample Output

No
#include <stdio.h>
#include <math.h>
int main()
{
int t,n;
int i,j;
int a,b; while(scanf("%d",&t)!=EOF)
{
while(t--)
{
int flag=;
scanf("%d",&n);
for(i=;i<=;i++)
{
if((int)sqrt(i*i*n+)*(int)sqrt(i*i*n+)==n*i*i+)
{
printf("%d\n",i);
flag=;
break;
}
}
if(flag==)
{
printf("No\n");
}
}
}
return ;
}

最新文章

  1. Hibernate 系列 08 - 对象识别机制
  2. JS中class和id的区别
  3. c#datagirdview ,用DataSource 方式赋值,然后更新出问题问题
  4. select值的获取及修改
  5. Dynamics AX Read OLEDB
  6. [C++][重载]
  7. seleniumAccessors
  8. python学习小结8:I/O
  9. Arch linux安装
  10. 一道面试题与Java位操作 和 BitSet 库的使用
  11. 处理PHP中字符串的常用操作及函数
  12. 751D·PARK北京时尚设计广场_百度百科
  13. VS插件
  14. XML学习经验实例总结2
  15. 怎样解决if __name__ == &quot;__main__&quot;:下面的代码没有执行的问题
  16. Chapter 5 Blood Type——6
  17. H5 28-优先级之权重问题
  18. cocos2dx-lua 延迟调用函数和定时器
  19. hdu1002-A + B Problem II-(java大数)
  20. python3 解决zip解压中文乱码问题,亲测可用, ZipFile

热门文章

  1. NYOJ 93 汉诺塔 (数学)
  2. Redis笔记之常用命令
  3. 大聊Python----装饰器
  4. 【译】第一篇 SQL Server代理概述
  5. DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead extract-text-webpack-plugin 提取css报错
  6. android 图片旋转 移动 放大缩小
  7. UML相关说明
  8. 9 - Python函数定义-位置参数-返回值
  9. linux配置samba服务【原创】
  10. anychat安装