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"

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

NEU 1009 Happiness Hotel的更多相关文章

  1. NBUT 1224 Happiness Hotel 2010辽宁省赛

    Time limit 1000 ms Memory limit 131072 kB The life of Little A is good, and, he managed to get enoug ...

  2. [NBUT 1224 Happiness Hotel 佩尔方程最小正整数解]连分数法解Pell方程

    题意:求方程x2-Dy2=1的最小正整数解 思路:用连分数法解佩尔方程,关键是找出√d的连分数表示的循环节.具体过程参见:http://m.blog.csdn.net/blog/wh2124335/8 ...

  3. BZOJ 2127: happiness [最小割]

    2127: happiness Time Limit: 51 Sec  Memory Limit: 259 MBSubmit: 1815  Solved: 878[Submit][Status][Di ...

  4. HDOJ 1009. Fat Mouse' Trade 贪心 结构体排序

    FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  5. 1009: [HNOI2008]GT考试

    1009: [HNOI2008]GT考试 Time Limit: 1 Sec Memory Limit: 162 MB Description 阿申准备报名参加GT考试,准考证号为N位数\(X_1X_ ...

  6. POJ 3667 Hotel(线段树 区间合并)

    Hotel 转载自:http://www.cnblogs.com/scau20110726/archive/2013/05/07/3065418.html [题目链接]Hotel [题目类型]线段树 ...

  7. ACM: Hotel 解题报告 - 线段树-区间合并

    Hotel Time Limit:3000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Description The ...

  8. HDU - Hotel

    Description The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and e ...

  9. 【POJ3667】Hotel

    Description The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and e ...

随机推荐

  1. the selection cannot be run on any server

    导入war包后运行jsp 显示: the selection cannot be run on any server 问题原因: Dynamic Web Module 的版本与server不匹配.Dy ...

  2. parseint和isNaN用法

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  3. Findbugs分析工具介绍

    Findbugs是一个静态分析工具,它检查类或者JAR 文件,将字节码与一组缺陷模式进行对比以发现可能的问题.Findbugs自带检测器,其中有60余种Bad practice,80余种Correct ...

  4. Python中OpenCV2. VS. CV1

    OpenCV的2.4.7.版本生成了python的CV2模块,可以直接载入: 有兴趣的可以参考这个教程:http://blog.csdn.net/sunny2038/article/details/9 ...

  5. redis启动出错 Creating Server TCP listening socket 127.0.0.1:6379: bind: No error解决办法

    windows下安装Redis第一次启动报错: [2368] 21 Apr 02:57:05.611 # Creating Server TCP listening socket 127.0.0.1: ...

  6. python的小数据池和深浅拷贝

    小数据池 一种数据缓存机制,也称驻留机制 在同一代码块,相同的值不会开辟新的内存 特殊字符除外 小数据池只针对:在控制台时! 数字 :-5到256间的整数会被缓存 布尔值:都会缓存8 字符串 小于等于 ...

  7. 团体程序设计天梯赛-练习集-L1-024. 后天

    L1-024. 后天 如果今天是星期三,后天就是星期五:如果今天是星期六,后天就是星期一.我们用数字1到7对应星期一到星期日.给定某一天,请你输出那天的“后天”是星期几. 输入格式: 输入第一行给出一 ...

  8. JS 20180416课时训练

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  9. Spring Boot project with static content generates 404 when running jar

    转自:http://stackoverflow.com/questions/21358403/spring-boot-project-with-static-content-generates-404 ...

  10. 工作中常见的Git本地分支与远程分支同步场景

    Git 是一个开源的分布式版本控制系统,可以有效.高速地处理从很小到非常大的项目版本管理.   一直以来本人使用 Git 处理分支都是现用现查,一是因为怕出错,二还是因为懒,作为一名四年开发经验的前端 ...