1009: Happiness Hotel

时间限制: 1 Sec  内存限制: 128 MB
提交: 173  解决: 19
[提交][状态][讨论版]

题目描述

The life of Little A is good, and, he managed to get enough money to run a hotel. The best for him is that he need not go to work outside, just wait for the money to go into his pocket. Little A wants everything to be perfect, he has a wonderful plan that he will keep one most beautiful reception whose size is 1()(which means the reception is 1 square meter). There are other k rooms that have the same area, and the area is x^2(), x is an integer; Little A wants his hotel to be a square. Little A is a good thinker, but not a good maker. As his poor performance on math, he cannot calculate the least area needed to build such a hotel of his will. Now, this task belongs to you, solve this problem to make Little A’s dream of Happy Hotel come true. Please be careful, the whole area should only contain k rooms, and the reception, there should not be any vacant place.

输入

There are several test cases.

Each case contains only one integer k(1<=k<=1000) ,the number of rooms the hotel should have in one line.

Proceed to the end of file.

输出

Output one integer d, means the hotel’s area is d^2(If there is no answer, output “no solution”) .The output of one test case occupied exactly one line.

样例输入

1
2
3

样例输出

no solution
3
2

提示

 

来源

辽宁省赛2010

题目大意:就是ans^2=d*x^2+1,其中ans,d,x都是正整数,现在给定d,输出最小可行的ans,如果没有就输出"no solution"

思路:佩尔方程。。。数轮题目

最新文章

  1. grep
  2. Metrics介绍
  3. kvm xxx.xml文件的位置
  4. javascript获取随机数的几种方式
  5. sqlite中的自增主键
  6. initWithFrame方法的理解
  7. java中double四舍五入并设置小数点位数的问题
  8. asp.net 的状态管理
  9. JavaFX 简单3D演示样例
  10. PHP:小数位计算
  11. memcache研究
  12. Openjudge-NOI题库-简单算术表达式求值
  13. C# 网络常用操作类NetHelper.cs
  14. 浅谈JS的变量提升
  15. &lt;转载&gt; FreeNAS的安装和简单配置 http://freenas.cn/?p=342
  16. 使用python处理百万条数据分享(适用于java新手)
  17. Mysql索引整理总结
  18. HTML5 &lt;Audio&gt;标签API整理(三)
  19. V-rep学习笔记:串口操作
  20. Publish/Subscribe Model——Notification chain——观察者模式

热门文章

  1. 依赖注入与Service Locator
  2. [ Tools ] [ MobaXterm ] [ SSH ] [ Linux ] export and import saved session
  3. dotnetnuke7.3.3 下弹出对话框(dnnConfirm())的使用
  4. VHDL_LIB之DFF
  5. 异常及String
  6. C++:数据流和缓冲区
  7. win 7环境下java环境变量的配置
  8. css—各浏览器下的背景色渐变
  9. CGContext与上下文
  10. Resolving Strong Reference Cycles for Closures