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. CentOS6.5下nginx-1.8.1.tar.gz的单节点搭建(图文详解)

    不多说,直接上干货! [hadoop@djt002 local]$ su root Password: [root@djt002 local]# ll total drwxr-xr-x. root r ...

  2. BZOJ1096: [ZJOI2007]仓库建设(dp+斜率优化)

    Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 5790  Solved: 2597[Submit][Status][Discuss] Descript ...

  3. Linux od与hexdump命令

    od命令:以指定格式输出文件内容常用格式:od -Ax -tx1 filename直接格式:od filename 等价 od -o filename语法:od [-abcdfsiloxv] [-An ...

  4. HTML实现图片360度循环旋转

    <style> .header{ -webkit-animation:rotateImg 5s linear infinite;<!--修改旋转周期--> border: 1p ...

  5. swift的计算属性和懒加载

    计算属性每次都重新计算. 懒加载只计算一次. 可以借助backing store将计算属性转化为懒加载属性. 计算属性实质上退化为函数调用. 计算属性的标示是get.set.

  6. Linux学习之路三:重要概念之Linux系统层次结构

    上图来自Unix编程圣经<APUE>英文第二版.如图,处于最中心的是系统内核,负责机器硬件资源管理,进程管理等:shell,函数库(值得记住的是C标准函数库)和某些应用程序均直接构建于内核 ...

  7. SQL数据查询2

    USE h CREATE TABLE zy1( empno INT, ename ), job ), mgr INT, hiredate DATE, sal DOUBLE, COOM DOUBLE, ...

  8. JS for循环的应用: 打印三角形

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

  9. 路飞学城Python-Day141

    什么是爬虫    爬虫就是通过编写程序模拟浏览器上网,然后让其去互联网上抓取数据的过程. 爬虫的目的就是为了模拟浏览器进行网络数据访问               抓取数据的两种方式          ...

  10. 复习MySQL①创建数据库及数据表

    • 创建数据库:create database 数据库名称; – 例:创建名为test的测试数据库 create database test; • 查看创建好的数据库:show create data ...